Niixie Posted March 30, 2011 Share Posted March 30, 2011 Hey, it looks like theres something wrong with my function to validate a user, but i dont know what it is? function SQL_VALID_USER($name, $pass, $email) { //if(SQL_PINK() == 1) { $query = sprintf("SELECT accountname, accountpassword, accountemail FROM members WHERE accountname = '%s', accountpassword = '%s', accountemail = '%s'", mysql_real_escape_string($name), mysql_real_escape_string($pass), mysql_real_escape_string($email)); $result = mysql_query($query); if (!$result) { return 0; } else { $_SESSION['auth'] = 1; return 1; } //} } Thanks for looking at it Quote Link to comment https://forums.phpfreaks.com/topic/232175-anything-wrong-with-this-function/ Share on other sites More sharing options...
xangelo Posted March 30, 2011 Share Posted March 30, 2011 What's the error that is appearing? Quote Link to comment https://forums.phpfreaks.com/topic/232175-anything-wrong-with-this-function/#findComment-1194372 Share on other sites More sharing options...
PFMaBiSmAd Posted March 30, 2011 Share Posted March 30, 2011 $result is either a FALSE value (if your query failed due to an error of some kind) or a result resource. If your query executes without any errors, you will get a result resource, that may or may not contain any row(s). After you test if the query executed without any errors, you would need to use mysql_num_rows() to find out how many row(s) the query matched. Quote Link to comment https://forums.phpfreaks.com/topic/232175-anything-wrong-with-this-function/#findComment-1194378 Share on other sites More sharing options...
Niixie Posted March 30, 2011 Author Share Posted March 30, 2011 I'm trying to make a redirect page, but it looks like i messed up in the sessions. Do i need session_start() in every page? Quote Link to comment https://forums.phpfreaks.com/topic/232175-anything-wrong-with-this-function/#findComment-1194411 Share on other sites More sharing options...
KevinM1 Posted March 30, 2011 Share Posted March 30, 2011 Do i need session_start() in every page? Yes. Quote Link to comment https://forums.phpfreaks.com/topic/232175-anything-wrong-with-this-function/#findComment-1194415 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.