master82 Posted February 12, 2007 Share Posted February 12, 2007 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/blabla/public_html/page.php on line 87 $emc = mysql_query("SELECT actid FROM activate WHERE actemail = {$_POST['email']}", $db); if(mysql_num_rows($emc)>0) { die("The email addressed is already in use!"); } Line 87 is: if(mysql_num_rows($emc)>0) Can anyone solve this? lol Link to comment https://forums.phpfreaks.com/topic/38229-solved-mysql_num_rows/ Share on other sites More sharing options...
Jessica Posted February 12, 2007 Share Posted February 12, 2007 $emc = mysql_query("SELECT actid FROM activate WHERE actemail = {$_POST['email']}") or die(mysql_error()); That will print an error for you. Link to comment https://forums.phpfreaks.com/topic/38229-solved-mysql_num_rows/#findComment-183103 Share on other sites More sharing options...
jcbarr Posted February 12, 2007 Share Posted February 12, 2007 $emc = mysql_query("SELECT actid FROM activate WHERE actemail='{$_POST['email']}'"); $rows=mysql_num_rows($emc); if ($rows>'0') { die("The email addressed is already in use!"); } If that doesn't work echo the $rows variable to see what you are getting back. It may be that you aren't actually getting any results from your query. Link to comment https://forums.phpfreaks.com/topic/38229-solved-mysql_num_rows/#findComment-183105 Share on other sites More sharing options...
master82 Posted February 12, 2007 Author Share Posted February 12, 2007 error returned: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@hotmail.co.uk' at line 1 Link to comment https://forums.phpfreaks.com/topic/38229-solved-mysql_num_rows/#findComment-183107 Share on other sites More sharing options...
jcbarr Posted February 12, 2007 Share Posted February 12, 2007 is that what it gave you when you used the code I posted? Cause I'm pretty sure that works with my SQL server... Link to comment https://forums.phpfreaks.com/topic/38229-solved-mysql_num_rows/#findComment-183110 Share on other sites More sharing options...
master82 Posted February 12, 2007 Author Share Posted February 12, 2007 no with the 1st reply, from the original query Link to comment https://forums.phpfreaks.com/topic/38229-solved-mysql_num_rows/#findComment-183114 Share on other sites More sharing options...
Jessica Posted February 12, 2007 Share Posted February 12, 2007 Try this. $email = mysql_real_escape_string($_POST['email']); $emc = mysql_query("SELECT actid FROM activate WHERE actemail='$email'"); Link to comment https://forums.phpfreaks.com/topic/38229-solved-mysql_num_rows/#findComment-183115 Share on other sites More sharing options...
master82 Posted February 12, 2007 Author Share Posted February 12, 2007 $emc = mysql_query("SELECT actid FROM activate WHERE actemail='{$_POST['email']}'"); $rows=mysql_num_rows($emc); if ($rows>'0') { die("The email addressed is already in use!"); } That worked! Thanks everyone Link to comment https://forums.phpfreaks.com/topic/38229-solved-mysql_num_rows/#findComment-183135 Share on other sites More sharing options...
Jessica Posted February 12, 2007 Share Posted February 12, 2007 you didn't change anything... Link to comment https://forums.phpfreaks.com/topic/38229-solved-mysql_num_rows/#findComment-183141 Share on other sites More sharing options...
jcbarr Posted February 12, 2007 Share Posted February 12, 2007 Yeah he did this part right here '{$_POST['email']}' Used to look like this {$_POST['email']} He needed to enclose that in ' ' Link to comment https://forums.phpfreaks.com/topic/38229-solved-mysql_num_rows/#findComment-183147 Share on other sites More sharing options...
Jessica Posted February 12, 2007 Share Posted February 12, 2007 Ah. Link to comment https://forums.phpfreaks.com/topic/38229-solved-mysql_num_rows/#findComment-183154 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.