如何在PHP中修复“ mysqli_num_rows()期望参数1为mysqli_result,给定布尔值”

时间:2019-07-23 08:15:55

标签: php mysql sql

此代码输出:“ mysqli_num_rows()期望参数1为mysqli_result,给定布尔值”,我试图在此网站上找到相同的情况,但找不到解决我问题的解决方案。

<?php
session_start();

$con = mysqli_connect('localhost','root','T07iSHxIblmIMc0c');

mysqli_select_db($con, 'login');

$name = $_POST['key'];
$pass = $_POST['password'];

$s = "SELECT * FROM users where name= '$name' && password = '$pass'";

$result = mysqli_query($con, $s);
$num = mysqli_num_rows($result);

if($num == 1){
    header('location:statistics.php');
}else{
    header('location:login.php');
}


?>

0 个答案:

没有答案