Answer the question
In order to leave comments, you need to log in
Why is the array not displayed?
The array is not displayed using the command print_r($user); . Just to see what happened.
$login = filter_var(trim($_POST['login']),
FILTER_SANITIZE_STRING);
$pass = filter_var(trim($_POST['pass']),
FILTER_SANITIZE_STRING);
$pass = md5($pass."adadagff231313");
$mysql = new mysqli('localhost', 'root', 'root', 'register-bd');
$result = $mysql->query("SELECT * FROM `users` WHERE `login` = '$login' AND `pass` = '$pass'");
$user = $result->fetch_assoc();
if(count($user) == 0) {
echo "Такой пользователь не найден";
exit();
}
print_r($user);
exit();
$mysql->close();
header('Location: /');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question