When I try to log in with the entered password, it does not redirect to another page, although the password is correct. And when you try to log in without a password, it redirects.
What could be the problem?
Code example:
if (empty($errors)) { $userQuery = "SELECT * FROM admins" ; $userResult = mysqli_query($connection, $userQuery); while($userRow = mysqli_fetch_assoc($userResult)) { if($userRow["username"] == $_POST["username"] && $userRow["password"] == $_POST["password"]) { $_SESSION["username"] = $_POST["username"]; redirect_to("../public/library.php"); //это Функция } } }
select *from the entire table. you can writeselect * from admins where username='pavel'and he will select the right entry and you don’t need to cycle through the entire table - Mike