This is my PHP code to get values from my sql table. It doesn't work, I'm still search if error is here or elsewhere... Some opinion?
function GetValuesFromDB($username,$password)
{
if(!$this->DBLogin())
{
$this->HandleError("Database login failed.");
return false;
}
$username = $this->SanitizeForSQL($username);
$pwdmd5 = md5($password);
$qry = "Select * from $this->tablename where username='$username' and password='$pwdmd5' and confirmcode='y'";
$result = mysql_query($qry,$this->connection);
if(!$result || mysql_num_rows($result) <= 0)
{
$this->HandleError("Error logging in. Username and Password do not match.");
return false;
}
$row = mysql_fetch_assoc($result);
$_SESSION['name_of_user'] = $row['name'];
$_SESSION['email_of_user'] = $row['email'];
$_SESSION['last_name_of_user'] = $row['last_name'];
$_SESSION['username_of_user'] = $row['username'];
$_SESSION['phone_number_of_user'] = $row['phone_number'];
$_SESSION['address_of_user'] = $row['address'];
$_SESSION['zip_code_of_user'] = $row['zip_code'];
return true;
}
Aucun commentaire:
Enregistrer un commentaire