Answer the question
In order to leave comments, you need to log in
How to get password from mysql query?
I'm trying to check user authorization. I do a check by nickname, and then I need to somehow get the password and compare.
$db = new mysqli($host, $user, $password, $database)
or die("Error " . mysqli_error($db));
$sql = "SELECT name, password FROM login WHERE name = '$login_admin->nickname'";
$res = $db->query($sql);
if($login_admin->password == $res->password){
echo "Ok";
}else{
echo "faslse";
}
Answer the question
In order to leave comments, you need to log in
$sql = "SELECT name, password FROM login WHERE name = '".addslashes($login_admin->nickname)."'";
$res = $db->query($sql);
$user = $db->fetch($res);
if($login_admin->password == $user->password){
echo "Ok";
}else{
echo "faslse";
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question