Warning when using mysql_fetch_assoc in PHP [duplicate]

By | July 12, 2018

Possible Duplicate:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result

When I run my php page, I get this error and do not know what’s wrong, can anyone help? If anyone needs more infomation, I’ll post the whole code.

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in
H:\Program Files\EasyPHP 2.0b1\www\test\info.php on line 16

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

$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>";


else {
    print "Database NOT Found ";


Leave a Reply

Your email address will not be published. Required fields are marked *