我试图创建一个只有登录页面的网页(我将数据手动插入数据库中,所以我没有注册页面),但是我的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');
}
?>