zero_ZX Posted April 1, 2009 Share Posted April 1, 2009 Hi all This is what i got: <?php mysql_select_db("phpaudit", $con); $query = "select email FROM phpaudit_clients WHERE email = {$_POST['email']} and forumacc = 0"; $result = mysql_query($query,$con); if(mysql_num_rows($result) < 1); /this one gives errors { echo "An error occoured: <br /> Either your email on your forum account didn't match your client account's email <br /> Or maybe you have alreaddy upgraded a forum account? You are only allowed to upgrade one forum account."; die(); } ?> Dunno why it gives errors? Quote Link to comment https://forums.phpfreaks.com/topic/152030-solved-mysql-not-true-then/ Share on other sites More sharing options...
Yesideez Posted April 1, 2009 Share Posted April 1, 2009 If you postr the errors it will give us something to play with. Would you take your car to the garage and say "it doesn't work properly?" They'd want to know HOW it doesn't work properly and a lot more information besides! oh, if you post code, please use the CODE tags... Quote Link to comment https://forums.phpfreaks.com/topic/152030-solved-mysql-not-true-then/#findComment-798417 Share on other sites More sharing options...
zero_ZX Posted April 1, 2009 Author Share Posted April 1, 2009 I used code tags?? Error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource Quote Link to comment https://forums.phpfreaks.com/topic/152030-solved-mysql-not-true-then/#findComment-798429 Share on other sites More sharing options...
premiso Posted April 1, 2009 Share Posted April 1, 2009 $result = mysql_query($query,$con) or die("SQL RAN: {$query}<br />Error: " . mysql_error()); That will tell you that there is an undefined column that will be the email address passed in via post. You need ' around string data. $query = "select email FROM phpaudit_clients WHERE email = '{$_POST['email']}' and forumacc = 0"; I would also use mysql_real_escape_string on string data being passed in from a form to be used in the DB as that code is prone to SQL Injection. Quote Link to comment https://forums.phpfreaks.com/topic/152030-solved-mysql-not-true-then/#findComment-798674 Share on other sites More sharing options...
zero_ZX Posted April 1, 2009 Author Share Posted April 1, 2009 Wow great.. thanks alot Any ways, even if 'forumacc' is = 0 the script still dies What could possible be wrong? Quote Link to comment https://forums.phpfreaks.com/topic/152030-solved-mysql-not-true-then/#findComment-798713 Share on other sites More sharing options...
premiso Posted April 1, 2009 Share Posted April 1, 2009 if(mysql_num_rows($result) < 1) //remove the semi-colon here Quote Link to comment https://forums.phpfreaks.com/topic/152030-solved-mysql-not-true-then/#findComment-798718 Share on other sites More sharing options...
zero_ZX Posted April 1, 2009 Author Share Posted April 1, 2009 Oh yea thanks alot, and then chage < to == ofcause Thanks alot! Quote Link to comment https://forums.phpfreaks.com/topic/152030-solved-mysql-not-true-then/#findComment-798864 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.