Hi I am trying to teach myself some php and get this error (below) when I query a sql database this is just a tutorial and will never go live.
I have hilighted the area in bold where the unseen error is.
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/dbconnect1.php on line 14
<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpassword= "password";
$dbdatabase = "productsdb";
$db = mysql_connect($dbhost, $dbuser, $dbpassword);
mysql_select_db($database, $db);
$sql = "SELECT * FROM products";
$result = mysql_query($sql);
[B]while ($row = mysql_fetch_assoc($result)) {
echo $row['product'];[/B]
}
?>
please go easy on me as am a novice...