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
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
Share on other sites

depends on keyboard on my mac its right of the lefthand shift key, on my pc its to the left of 1

 

````````````

 

theres some i given you for free, please copy and paste

 

Found it on my keyboard, thank you :D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.