我一直在登录页面,我的代码没有工作,有没有人对我应该做什么有任何提示或想法。当我回显num_rows时,它显示0,而不是数据库中实际的行数。
$Email = mysqli_real_escape_string($dbc, trim($_POST['Email']));
$Password = mysqli_real_escape_string($dbc, trim($_POST['Password']));
//Look up the email and password in the database
$query = "SELECT * FROM Users WHERE Email = '$Email' AND Password = MD5('$Password')";
$data = mysqli_query($dbc, $query);
$count = mysqli_num_rows($data);
echo "Num of Rows: " . $count . "<br/>";
答案 0 :(得分:1)
将密码声明和查询更改为此。它会解决问题
$ Password = md5($ _ POST [&#39;密码&#39;]);
$ query =&#34; SELECT * FROM Users WHERE Email =&#39; $ Email&#39; AND密码=&#39; $密码&#39;&#34;;