header("Content-type:text/html charset=utf8");$mysqli=new mysqli('localhost','root','***','test');if($mysqli->connect_errno){ die("Connect Error:".$mysqli->connect_error);}$mysqli->set_charset('utf8');$username=$_POST['username'];$password=md5($_POST['password']);$sql="SELECT * FROM t1 WHERE username=? AND password=?";$mysqli_stmt=$mysqli->prepare($sql);$mysqli_stmt->bind_param('ss',$username,$password);if($mysqli_stmt->execute()) { $mysqli_stmt->store_result(); if($mysqli_stmt->num_rows>0){ echo "登陆成功"; }else{ echo "登陆失败"; }}如以上代码,为什么给password加上md5数据库就获取密码失败并且登录失败,而把md5去掉并且不使用md5加密passwrod就可以登陆成功,这是为什么?
添加回答
举报
0/150
提交
取消