Hi,
I don't know what I am doing wrong, but I tried both styles a dozen ways, to no avail. Using
echo $aID[id];
did display a number, but it was the same number for each entry.
Using
while ($row = mysql_fetch_assoc ($result))
{
echo 'primary key = ' . $row['id'] . '<br>';
}
would not display any numbers.
So here is my exact code. Maybe someone can tell me what I am doing wrong and where I need to place the code for displaying a unique id number for each item.
Thanks
if ($type == "")
{$type = '%';}
{$aID = 'id';}
if ($title == "")
{$title = '%';}
$result = mysql_query ("SELECT * FROM recipe1
WHERE type LIKE '$type%'
AND title LIKE '$title%'
");
if ($row = mysql_fetch_array($result)) {
do {
printf("Type of Recipe: %s\n<br>", $row["type"]);
print (" ");
printf("Title of Recipe: %s\n<br>", $row["title"]);
echo "<a href=\"$title\">$title</a>";
echo"<a href=\"RecipeShow.php?id=$aID\">$aID</a>";
print ("<p>");
printf("First Name: %s\n<br>", $row["first"]);
printf("Last Name: %s\n<br>", $row["last"]);
} while($row = mysql_fetch_array($result));
} else {print "Sorry, no records were found!";}