I need to select only the password from the table with the specific username entered through the registration form. I store the password in encrypted form in the mysql table. Therefore, I need to compare this password and the saved password and print "successfully logged in". otherwise the password is incorrect. this is my code. Now I get the output as "1Resource id # 4" .can any help plz ...
mysql_select_db($dbName);
$user_name=$_POST['name'];
$pswd=$_POST['pswd'];
$res = mysql_query("select * from xxx where Name='$user_name'");
$row = mysql_num_rows($res);
echo $row;
$encpass=mysql_query("SELECT password FROM xxx WHERE Name = '$user_name'");
$result1= mysql_fetch_array($encpass);
echo $result1;
if($row>0)
{
//echo 'hi';
if(md5($pswd)==$result1)
{
echo 'hi';
echo "you have successfully signed in!!!";
//echo $name = $row['Name'];
//header("location:check.html");
}
}
else
echo "you are not a member";
krishna
source
share