Jump to content

Recommended Posts

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 :)

Link to comment
https://forums.phpfreaks.com/topic/232175-anything-wrong-with-this-function/
Share on other sites

$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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.