mysql_fetch_assoc Error

[php] <?PHP

    $user_name = "root";
    $password = "";
    $database = "addressbook";
    $server = "127.0.0.1";

$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);

if ($db_found) {

$SQL = "SELECT * FROM tb_address_book";
$result = mysql_query($SQL);

while ($db_field = mysql_fetch_assoc($result)) {
    print $db_field['ID'] . "<BR>";
    print $db_field['First_Name'] . "<BR>";
    print $db_field['Surname'] . "<BR>";
    print $db_field['Address'] . "<BR>";
}

mysql_close($db_handle);

}
else {
   print "Database NOT Found ";
   mysql_close($db_handle);
}

?>[/php]
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\Program Files (x86)\EasyPHP-5.3.6.0\www\Database.php on line 16

Hi I keep getting this error and I cant seem to find a solution for it. I’ve been following a tutorial that I found on this page
http://www.homeandlearn.co.uk/php/php13p2.html
Any help would be greatly appriciated

The problem is in your SQL. try to check the name of your table “tb_address_book” on your database.
you might have misspelled it.

Sponsor our Newsletter | Privacy Policy | Terms of Service