I have the following code:
Code: Select all
<?php
/* declare some relevant variables */
$DBhost = "localhost";
$DBuser = "username";
$DBpass = "password";
$DBName = "myDB";
$table = "category";
/* connect to database */
$link = mysql_connect($DBhost,$DBuser,$DBpass);
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
/* create the query to compare the form data with the user table */
$sqlquery = "SELECT * FROM $table WHERE ID = $ID";
/* run the query and check it worked */
$result = mysql_query($sqlquery,$link);
if (!$result = mysql_query($sqlquery,$link))
exit("Illegal query");
/* get the number of rows returned by the query */
$number = mysql_num_rows($result);
print "this is " . $row["CategoryName"] . "<br>";
print "this is " . $row["ImageLocation"];
?>What have I done wrong? Almost the exact same code has worked on other pages.