Below is the code I'm using.
Supposedly, on the first run it displays the first and last names of the items in my database in hyperlinks that will display more detailed information about each item by using a URL-passed parameter "id". For some reason, when the hyperlinks are clicked, it doesn't recognize the parameter "id"! Anyone know why? Do I have to somehow allow PHP to get URL-passed parameters to incorporate as usable variables into the code? The way it seems to be running it is NEVER getting passed the URL-attached parameter!
Here's the code:
<BODY>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
if ($id)
printf("HAVE ID#%s!<BR>",$id);
else
printf("NO ID#!<BR>");
//display individual record
if ($id)
{
$result = mysql_query("SELECT * FROM employees WHERE id=$id",$db);
$myrow = mysql_fetch_array($result);
printf("First Name: %s\n<BR>", $myrow["first"]);
printf("Last Name: %s\n<BR>", $myrow["last"]);
printf("Address: %s\n<BR>", $myrow["address"]);
printf("Description: %s\n<BR>", $myrow["description"]);
} else //show employee list
{
$result = mysql_query("SELECT * FROM employees",$db);
if ($myrow = mysql_fetch_array($result))
{
do
{
printf("<A href=\"%s?id=%s\">%s %s</a><BR>\n", $PHP_SELF, $myrow["id"], $myrow["first"], $myrow["last"]);
} while ($myrow = mysql_fetch_array($result));
} else
{
echo "Sorry, No Records Found";
}
}
?>
</body>