Jump to content

mysql query


Jacbey

Recommended Posts

Hi Guys,

 

I have been having problems with a piece of PHP and mysql. I was wondering if you could help me out?

 

The error is = Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /customers/klueless.net/klueless.net/httpd.www/daisysite/home.php on line 120 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /customers/klueless.net/klueless.net/httpd.www/daisysite/home.php on line 122

 

And this is the code which goes with these errors =

 

$msgquery = "SELECT * FROM spotty_messages WHERE (id_receiver = '" . $userid . "') AND read = '0'";

$messageres = mysql_query($msgquery);

$messrow = mysql_fetch_array($messageres);

$messagecount = mysql_num_rows($messageres);	

Link to comment
https://forums.phpfreaks.com/topic/235649-mysql-query/
Share on other sites

@jacbey: error means that your query is failing, a good reason for that is the usage of a mysql reserved word

 

read is one of them.... 2 options:

a) change the name of the column (the best long term solution) or

b) enclose it in backtics in this way `read`

 

Thank you, I'll change the column name. :) How do you get backtics? Because I don't see a key on my keyboard for that.

Link to comment
https://forums.phpfreaks.com/topic/235649-mysql-query/#findComment-1211212
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.