撇开 SQL 注入和其他安全问题不谈,我在尝试使以下代码工作时遇到了问题。我知道我很接近,但不知道该怎么做。目前我收到此错误消息:
“成功连接警告:mysqli_fetch_array() 期望参数 1 为 mysqli_result,布尔值在 C:\xampp\htdocs\proper\checklogin.php 第 30 行错误的用户名/密码中给出”
检查登录.php
<?php
session_start();
// Connect to server and select databse.
$conn= mysqli_connect("localhost", "root", "")
or die ('No connection');
print "Successful Connection";
mysqli_select_db($conn , 'ssssg3') or die ('database will not open');
// username and password sent from form
$email=$_POST['email'];
$password=$_POST['password'];
$sql = "SELECT * FROM log_in_info where email=$email";
$result=mysqli_query($conn, $sql);
$row=mysqli_fetch_array($result);
if ($row['password'] == $password) {
header('location:main1.php');
}
else
{
echo 'wrong username/password';
}
?>