Can someone please help, I have this code below and every time i execute it i get this error:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/dbconnect1.php on line 14
I can work out what i am doin wrong.
<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpassword= "spewguts";
$dbdatabase - "productsdb";
$db = mysql_connect($dbhost, $dbuser, $dbpassword);
mysql_select_db($database, $db);
$sql = "SELECT * FROM products;";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
echo $row['product'];
}
?>