I use the following code to access my Db in various places but on one page I get the error shown at the bottom. What's going on ?
// access D/b
$db = @mysql_connect("localhost","user","pass") or header("Location: maint.php");
mysql_select_db("dbname",$db) or header("Location: maint.php");
// Get title & description
$result = mysql_query("SELECT dsc FROM gcc_desc WHERE code = $code",$db);
while ($myrow = mysql_fetch_array($result)) {
$dsc = ($myrow['dsc']);
}
error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /item_detail.php3 on line 14
(note: line 14 points to the WHILE statement)
The value in $code matches a record in the table and everything is spelt correctly 🙂
Thanks for any help