MySQL Forums
Forum List  »  Newbie

Re: Newbie: How to get a value from a mysql table in PHP
Posted by: ashkaan57
Date: July 29, 2005 03:26PM

Hopefully you stored the password in usertable encrypted (assigned the function password() to the field).
If so, you have to use the password function to check it:

$result = mysql_query("select * from usertable where username='$user' and password = password('$pass')");

if not,

$sql = "SELECT * FROM usertable WHERE username ='$user' AND password = '$pass'";
$result=mysql_query($sql);

either way:

if (!mysql_num_rows($result)) // no matching row was found
return 0;
}

Options: ReplyQuote


Subject
Written By
Posted
Re: Newbie: How to get a value from a mysql table in PHP
July 29, 2005 03:26PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.