Hello! 🙂
I do have a food recipe database, I am using this to sort out all recipies that has gotten any comment from visitors.
$Query="SELECT DISTINCT recid FROM comments";
$Result = mysql_query($Query) or die("Error: ".mysql_error()." in query: ".$Query);
while($row=mysql_fetch_array($Result))
{
echo "<a href=\"rec.php?id=" . $row['recid'] . "\" CLASS=\"url1\">";
echo $row['recid'];
echo "</a>";
echo "<br>\n";
}mysql_close($dbh);
It works fins, but this gives the number to click on instead of the recipe name. :rolleyes:
The trick is that the recipe name is not in the comments table, that is instead in the table: recipies
id, recipename, date etc....( where "id" is the same as "recid" from the comments table).
Thanks in advance.