Hi all,
Can anyone see the problem with the following script:
<?
$result = mysql_query("SELECT * FROM faq_cat WHERE status='yes' ORDER BY title",$db);
while ($row = mysql_fetch_array($result)) {
$new_id = $row["faq_cat_id"];
$title = $row["title"];
echo "<br><H2>";
echo "$title $new_id";
echo "</H2>";
$result2 = mysql_query("SELECT * FROM faq WHERE faq_cat_id = '$new_id' AND status='yes' ORDER BY question",$db);
while ($row2 = mysql_fetch_array($result2)) {
$cool_id = $row2["faq_cat_id"];
$faq_id = $row2["faq_id"];
$question = $row2["question"];
?>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td valign="top" width="20"><img src="images/blue_arrow.gif" align="absmiddle"></td>
<td align="left"><A href="faq.php?answer=<? echo $faq_id ?>"><? echo $question ?></A></td>
<?
}
}
}
?>
If the "faq_cat_id" from the faq_cat table is lets say equal to "1" then i want all the "question" results from the "faq" table (second query) to display under it's corresponding "title".
My problem is that there are five rows in the "faq" table that have the "faq_cat_id" value of "1"... however, it only displays four. The fifth row does display but under the "faq_cat.title" which has the "faq_cat_id" of "2".
Any ideas on how to put this value under it's proper title.
I hope that made sense?
Cheers,
micmac