I was going through this tutorial and it states to put in a variable in an if statement that has not been initialized. From my understanding, it seems the the desired affect being sought is that the if statement would return flase if the variable is not declared but instead there is an error message.
Here is the php file being mentioned, the link to the tutorial follows underneath. Thanks ahead of time to who ever clears this up for me.
<html>
<body>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$PHP_SELF='display_2nd_set.php';
// 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("Position: %s\n<br>", $myrow["position"]);
}
else
{
//show employee list
$result = mysql_query("SELECT * FROM employees",$db);
if ($myrow = mysql_fetch_array($result))
{
// display list if there are records to display
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
{
// no records to display
echo "Sorry, no records were found!";
}
}
?>
</body>
</html>
http://webmonkey.wired.com/webmonkey/99/21/index3a_page3.html?tw=programming