Jump to content

Anything wrong with this function?


Niixie

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.