I'm trying to write some code that will connect to a database called 'user' and find data from the 'password' field. I've got this PHP written so far:
$passw = $_POST['pass'];
$user = $_POST['user'];
$users_password_db = "SELECT password FROM 'user' WHERE username=$user";
$result = $mysqli->query($users_password_db);
if ($passw != $result){
$errors[] = "Incorrect username or password. Please try again, or contact the admin for support.";
}
else {
header('Location: /dashboard.php');
}
However, every time I log in with my correct username and password, it says that the password is wrong. I don't think this is a connection error, since I can add data into the database okay.
I'm just beginning with SQL, so sorry if this is an obvious question.