mysql_num_rows(): Error

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/****/public_html/coreg/********.php on line 65


$query = "SELECT * FROM data WHERE Email='$email'";
				mysql_query($query);
				$result = mysql_query($query);
				$count=mysql_num_rows($result);

Hey Guys,

Hope you all had a good weekend, Not sure why im getting this error, i just bought a new powerfull dedicated server so not sure if its something to do with my code or the settings in php.ini.

Any help would be great guys.

Thanks a lot!

It means the query didn’t execute well. Try displaying the error:

 mysql_query($query) or die('mysql error ' . mysql_error() . ' in query ' .$query);

Thanks i relised what the problem was, for security i was only allowing the db user to INSERT and not anything else, so just changed that so it can SELECT too now and everythign works fine :slight_smile:

Thanks anyway.