mysqli_query返回false

时间:2019-08-03 18:43:11

标签: mysql sql mariadb

我试图创建一个只有登录页面的网页(我将数据手动插入数据库中,所以我没有注册页面),但是我的mysqli_query返回false。

代码如下:

<?php
    session_start();

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

    mysqli_select_db($con, 'login');

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

    $s  = "select * from utenti where name = '$name' && password = '$pass'";

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


    $num = mysqli_num_rows($result);

    if($num ==  1)
    {
        header('location:home.php');
    }
    else
    {
        header('location:index.php');
    }
?>

0 个答案:

没有答案