遇到了点问题,得不到正确的结果~~~大神帮忙看下
下面是我的dologin.php的代码
header("content-type:text/html;charset=utf-8");
$mysqli = new mysqli('localhost','root','','test');
$mysqli->set_charset('utf8');
if ($mysqli->connect_errno)
{
die($mysqli->error);
}
$username = $_POST['username'];
$password = md5($_POST['password']);
$sql="SELECT * FROM test01 WHERE username=? and password=?" ;
$mysqli_stmt=$mysqli->prepare($sql);
$mysqli_stmt->bind_param('ss', $username, $password);
$con = $mysqli_stmt->execute();
echo $mysqli_stmt->num_rows;
print_r($mysqli_stmt);
sql和$con都没有错,数据库里面也是有数据的,从login页面传过来的数据也能对应到数据库里的数据,dologin执行的结果是0,$mysqli_stmt的内容是:
mysqli_stmt Object( [affected_rows] => -1 [insert_id] => 0 [num_rows] => 0 [param_count] => 2 [field_count] => 4 [errno] => 0 [error] =>
[sqlstate] => 00000 [id] => 1)