General Community > Scripting Help
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given i
(1/1)
fuelpop:
<?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);
}
?>
i m get a Warning in php code
please help me to solve this problem
Arantor:
There's gotta be an error coming off the mysql_query call, try: $result = mysql_query($SQL) or die(mysql_error());
Then see what error it gives you (not recommended for production use but good for debugging)
fuelpop:
Thanks ,i got it!!!
Navigation
[0] Message Index
Go to full version