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 Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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... Quote Link to comment 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 Quote Link to comment 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'"); Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 12, 2007 Share Posted February 12, 2007 you didn't change anything... Quote Link to comment 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 ' ' Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 12, 2007 Share Posted February 12, 2007 Ah. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.