doLogin.php:
<?php
header('content-type:text/html;charset=utf-8');
$mysqli=new mysqli('localhost','root','123456','test');
if($mysqli->errno){
die('Connect Error'.$mysqli->error);
}
$mysqli->set_charset('UTF8');
$username=$_POST['username'];
$password=md5($_POST['password']);
$sql="SELECT * FROM user WHERE username='{$username}' AND password='{$password}'";
$mysqli_result=$mysqli->query($sql);
if($mysqli_result && $mysqli_result->num_rows>0){
echo '登陆成功';
}else{
echo '登陆失败';
}
上述代码如果$password不用md5加密,就能正常查询,但是查询加密后的信息就显示结果为空
At000