Re: what is the problem with this query?

From: Date: Fri, 30 Dec 2005 19:23:38 +0000
Subject: Re: what is the problem with this query?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-228036@lists.php.net to get a copy of this message
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

« previous php.general (#228036) next »