-1
<?php
include("db.php");
if (isset($_POST['entrar'])) {
$email = $_POST['email'];
$pass = $_POST['pass'];
$verifica = mysqli_query($connect, "SELECT * FROM users WHERE
email = '$email' AND pass='$pass'");
if (mysqli_num_rows($verifica)<=0) {
echo "<h3>A senha ou o e-mail tão torto aí heinKK!</h3>";
} else {
setcookie("login",$email);
header("Location: ./");
}
}
?>
I’m trying to create a social network as a form of learning and experience in PHP and MYSQL.
The error that appears is:
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result,
boolean given in C:\xampp\htdocs\redesocial\login.php on line 7
I’ve tried to get in line if
the following argument:
if (!verifica || mysqli_num_rows($verifica)<=0) {}
However, when you click on the login button, it seems that the email and password are not being checked in the database since it simply "logs in" even with the empty login and pass boxes.
Related: Mysql error "expects Parameter 1 to be Resource, Boolean Given in"
– Icaro Martins
Related: Warning: mysql_num_rows() expects Parameter 1 to be Resource, Boolean Given in [duplicate]
– Icaro Martins
Add
or die(mysqli_error($connect))
on the line of$verifica
to see the error that returns.– Sam
Returns this Unknown column 'pass' in 'Where clause'
– Kyatsu