致命错误:未捕获错误:在/home/matrixhub/public_html/login.php:64中调用null上的成员函数run_query() 堆栈跟踪:
第64行/home/matrixhub/public_html/login.php中引发#0 {main}
我认为run_query
是一个功能但是没问题。以下是第57至79行:
if (isset($_POST['login'])) {
$name = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT * FROM users WHERE username = '$email'";
$result = $obj->run_query($query);
if ($count = mysqli_num_rows($result) > 0) {
$row = $result->fetch_object();
if (password_verify($password, $row->password)) {
$_SESSION['email'] = $email;
$_SESSION['username'] = $name;
echo "Logged in";
} else {
echo "Not logged in";
}
} else {
echo "<script>alert('Your username or password is incorrect!')</script>";
}
}