Hello:
I was hoping someone could take a loop at this and tell me what is wrong with the nested while loop. Basically what I have is two query results that I would like to loop through. For some reason the nested while loop loops forever. I have @mysql_data_seek($cat_result2,0); outside of the nested loop.
If i remove: @mysql_data_seek($cat_result2,0); the first instance of the while loop only processes the first result then stops after the nested loop does its thing. Any ideas or better ways to execute this?
while ($row = @mysql_fetch_array($cat_result)) {
if ($row["parent_id"] == "0" && $row["id"] != "0") {
echo "var $row[1]Array = new Array(\"('Select Category','',true,true)\",\n";
$id = $row["id"];
while ($sub_row = @mysql_fetch_array($cat_result2)) {
if ($sub_row["parent_id"] == $id) {
echo "\t\"('$sub_row[1]')\",\n";
}
}
@mysql_data_seek($cat_result2,0);
}
}
Thanks,
Rupp