我试图从我的MySQL表中获取用户名和密码,我之前已经完成了这项工作,但是现在我收到了这个错误,
警告:mysql_num_rows()期望参数1为资源,第13行的C:\ xampp \ htdocs \ dashboard \ jetty \ loginver.php中给出布尔值,
我认为这是因为查询没有通过,非常感谢任何帮助。我的数据库是用户,该表称为帐户。该列是用户名和密码
PHP
<?php
$user = $_POST['username'];
$pass = $_POST['password'];
if($user == "" | $pass == "") {
header('Location: login.php?LoginBlank=True');
}else {
$query = "SELECT * FROM accounts WHERE username='$user' AND
password='$pass'";
$result=mysql_query($query);
$numrows = mysql_num_rows($result);
if($numrows == 1) {
echo "Logged In";
// Will add sessions later once i get this to work :)
} else {
echo "Not logged in";
}
}
?>