Website Hosting for Just 20 ForumCoin ~ Advertise on ForumCoin
52 Life Tips Banner
Talk hardware, software, computer gaming, mobile devices, the Internet, social networking and other technology

Warning

Postby germainebull » 28 Sep 2017, 09:12

I am getting this error message while browsing certain site:

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in / .....

What is this error?
  • 0

User avatar
germainebull
Banned
 
Posts: 8,573
Referrals: 35
ForumCoin: 100

Re: Warning

Postby gilggg » 28 Sep 2017, 09:28

You can try this code:
Code: Select all
<?PHP
$sql = 'some query...';
$result = mysql_query($q);

if (! $result){
   throw new My_Db_Exception('Database error: ' . mysql_error());
}

while($row = mysql_fetch_assoc($result)){
  //handle rows.
}
?>

Note the check on (! $result) -- if your $result is a boolean, it's certainly false, and it means there was a database error, meaning your query was probably bad.
  • 0

User avatar
gilggg
 
Posts: 1,446
Referrals: 1
ForumCoin: 68

Re: Warning

Postby CyberFreak » 28 Sep 2017, 17:27

It is a coding error... really those debug/warnings should not be visible to visitors (well it is good practice not to have them visible anyway) but it is nothing you can fix if you don't run the site. Maybe email the site admin(s) to notify them but other than that, ignore it.
  • 2

User avatar
CyberFreak
Tech Admin
 
Posts: 4,170
Location: UK
Referrals: 32
ForumCoin: 45,431

Re: Warning

Postby germainebull » 29 Sep 2017, 04:09

CyberFreak wrote:It is a coding error... really those debug/warnings should not be visible to visitors (well it is good practice not to have them visible anyway) but it is nothing you can fix if you don't run the site. Maybe email the site admin(s) to notify them but other than that, ignore it.


Given that I no longer see this error message, I have chosen to ignore it. In any case, I have no coding expertise.

Thanks for your advice. :)
  • 0

User avatar
germainebull
Banned
 
Posts: 8,573
Referrals: 35
ForumCoin: 100

Re: Warning

Postby thisnthat » 30 Sep 2017, 19:32

CyberFreak wrote:It is a coding error... really those debug/warnings should not be visible to visitors (well it is good practice not to have them visible anyway) but it is nothing you can fix if you don't run the site. Maybe email the site admin(s) to notify them but other than that, ignore it.


I almost didn't recognize you. :lol:

Is this true of other errors as well? Is it safe to ignore them or is it better to leave the site if it's jacked up?
  • 0

User avatar
thisnthat
 
Posts: 5,538
Referrals: 1
ForumCoin: 383



Your Ad Here.

Return to CGT - Computers, Gaming & Technology



Who is online

Users browsing this forum: Claude [Bot] and 1 guest

Reputation System ©'