While loops within while loops? - 05/09/2004 9:10 AM
I am rather stuck with this :/
Basically I need a while loop to run through the list of Bo_Keywords in my database. At each cycle of the first loop I need a second loop to cycle through all the post numbers that have the current Bo_Keyword associated with them. Finally, when the second loop finds a post number that corresponds to what is held in the variable "$paction" I want it to perform the echo and include as shown in the code below.
Where am I going wrong?
Basically I need a while loop to run through the list of Bo_Keywords in my database. At each cycle of the first loop I need a second loop to cycle through all the post numbers that have the current Bo_Keyword associated with them. Finally, when the second loop finds a post number that corresponds to what is held in the variable "$paction" I want it to perform the echo and include as shown in the code below.
Where am I going wrong?
Code
<br /><br /> $query = "<br /> SELECT Bo_Keyword<br /> FROM {$config['tbprefix']}Boards<br /> WHERE Bo_CatName = 'Quests'<br /> ORDER BY Bo_Sorter ASC<br /> ";<br /> $sti = $dbh -> do_query($query);<br /><br /> while(list($QKeyword) = $dbh -> fetch_array($sti)){<br /> <br /> $query = "<br /> SELECT B_Number<br /> FROM {$config['tbprefix']}Posts<br /> WHERE B_Board = '$QKeyword'<br /> AND B_Approved = 'yes'<br /> AND B_Parent = '0'<br /> ORDER BY B_Posted ASC<br /> ";<br /> $sti = $dbh -> do_query($query);<br /> <br /> while(list($PostNum) = $dbh -> fetch_array($sti)){<br /> <br /> if ($paction == $PostNum) {<br /> echo "$widerightcolstart";<br /> include "{$palspath}/pals/questslistpal.php"; <br /> } <br /> }<br /> }<br />