View Single Post
  #1 (permalink)  
Old February 15th, 2012, 02:08 PM
gkman gkman is offline
Registered User
Points: 32, Level: 1
Points: 32, Level: 1 Points: 32, Level: 1 Points: 32, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2011
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Default how do i check if query is empty?

Hey everyone.

I am trying to check if my query returned any row of info.

I tried using the empty() function - fail.
I guess this is because my $result isnt a empty variable- it contains an empty query.

I tried to use the mysql_num_rows()==0 function - also no good.
This is because it is possible that my query will return only one row of info (and it does) which will cause the above function to return 0.

I did try:

Code:
$result = mysql_fetch_array($result)
if ( mysql_num_rows($result)==0 && $result[0] = ' ')
That seemed to worke but it doesn't seem right to me because it is possible to have an empty block of info, And this condition won't be good for that.

So how do you check if the query is empty?
Reply With Quote