Re: [PHP] what is the problem with this query?
thanks. i have resolved the problem by replacing 'read' with 'read_it'. On 12/30/05, Michael Gross [EMAIL PROTECTED] wrote: read is a reserved word in mysql (http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html). You have to double-quote reserved words: mysql_query(SELECT * FROM mailbox WHERE \read\=''); Graham Cossey wrote: On 12/29/05, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] could you please tell me what is the problem with this query mysql_query(SELECT * FROM mailbox WHERE read=''); i always get this warning: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in index.php on line 24 [/snip] THere is no apparent problem with the query, but there is a problem with mysql_num_rows(). Can you show us he code there? I would hazard a guess that mysql_num_rows() is not being passed the correct query result handle as a parameter. ie: $result = mysql_query(...); $rows = mysql_num_rows($result); -- Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is the problem with this query?
On Thu, December 29, 2005 7:26 am, sunaram patir wrote: could you please tell me what is the problem with this query mysql_query(SELECT * FROM mailbox WHERE read=''); Nope. Because on the face of it, there is NOTHING wrong with the query written above, per se. i always get this warning: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in index.php on line 24 While *I* can't tell you what is wrong, and nobody on this entire list could tell you what is wrong, MySQL and PHP are just BEGGING to tell you what's wrong: $result = mysql_query($query) or die(mysql_error()); http://php.net/mysql_error Actually, there *IS* one obvious thing wrong with the query: You used SELECT * and that is a horrible horrible habit to get into. Don't do it. Name the columns you actually want. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] what is the problem with this query?
[snip] could you please tell me what is the problem with this query mysql_query(SELECT * FROM mailbox WHERE read=''); i always get this warning: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in index.php on line 24 [/snip] THere is no apparent problem with the query, but there is a problem with mysql_num_rows(). Can you show us he code there? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is the problem with this query?
On 12/29/05, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] could you please tell me what is the problem with this query mysql_query(SELECT * FROM mailbox WHERE read=''); i always get this warning: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in index.php on line 24 [/snip] THere is no apparent problem with the query, but there is a problem with mysql_num_rows(). Can you show us he code there? I would hazard a guess that mysql_num_rows() is not being passed the correct query result handle as a parameter. ie: $result = mysql_query(...); $rows = mysql_num_rows($result); -- Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is the problem with this query?
read is a reserved word in mysql (http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html). You have to double-quote reserved words: mysql_query(SELECT * FROM mailbox WHERE \read\=''); Graham Cossey wrote: On 12/29/05, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] could you please tell me what is the problem with this query mysql_query(SELECT * FROM mailbox WHERE read=''); i always get this warning: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in index.php on line 24 [/snip] THere is no apparent problem with the query, but there is a problem with mysql_num_rows(). Can you show us he code there? I would hazard a guess that mysql_num_rows() is not being passed the correct query result handle as a parameter. ie: $result = mysql_query(...); $rows = mysql_num_rows($result); -- Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php