我试图通过PHP脚本获取用户凭据,但我强迫一个问题。源代码是
<?php
include 'utilities.php';
$conn = openDB();
$table = "customer";
$username = $_POST['username'];
$pwd = $_POST['pwd'];
$sql = "SELECT * FROM $table WHERE username = '{$username}' and pwd = '{$pwd}' ";
$result = $conn->query($sql);
if($result->num_rows > 0)// here is line 12
{
echo "<br /> Successfully logged in as $username";
if ($username == "admin")
echo "<a href='Administrator.html'>Administrator</a>";
else
echo "<a href = 'UserMenu.html'>UserMenu</a>";
}
else
{
echo "<br /> Invalid Login";
}
$conn->close();
?>
和错误是
成功连接
注意:尝试在
中获取非对象的属性 第12行的C:\ xampp \ htdocs \ myhost \ ProcessLogin.php
登录无效