我在获取MySQL
专栏时遇到了麻烦。mysql 中的所有内容都设置了用户名、密码、数据库、表和列。
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given
in /Applications/XAMPP/xamppfiles/htdocs/socialhut/login.php on line 8
这是 login.php 的代码:
<?php
$username = $_POST['username'];
$password = $_POST['password'];
$conn = mysqli_connect("localhost","root","","data");
$sql = "SELECT * FROM userdata WHERE username='$username' and password='$password'";
$query = mysql_query($sql);
$result = mysql_num_rows($query);
if ($result==1){
session_register($username);
session_register($password);
header('location:members.php');
}else{
mysql_error();
}
?>
任何人都可以弄清楚吗?谢谢!