Aight I am trying to get this function to work everything in the function looks right but when I do for example TutorialDisplay( $_GET['id'],PHP ) it displays all the tutorials in the database when I only want it to display one type.. can any one help?
PHP Code:
function TutorialDisplay( $id , $type ) {
$db = mysql_connect("localhost", "USERNAME", "PASSWORD");
mysql_select_db("DATABASE",$db);
// display individual record
if ($id) {
$result = mysql_query("SELECT * FROM Tutorial WHERE id=$id AND Category=$type",$db);
$myrow = mysql_fetch_array($result);
printf("<b>%s\n<br></b>", $myrow["Title"]);
printf("<p align=\"center\">%s</p>", $myrow["Tutorial"]);
} else {
// show employee list
$result = mysql_query("SELECT * FROM Tutorial",$db);
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
do {
printf("<a href=\"%s?id=%s\">%s</a><br>\n", $PHP_SELF, $myrow["id"], $myrow["Title"]);
} while ($myrow = mysql_fetch_array($result));
} else {
// no records to display
echo "Sorry, no records were found!";
}
}
}