$conn = mysqli_connect($servername,$username,$password);
if ($conn) {
// $conn->query("SET NAMES 'UTF8'");
mysqli_select_db($conn,$dbname);
$search = "select check_num FROM check where check_num ='".$_POST["number"]."'";
$result = mysqli_query($conn,$search);
$datarow = mysqli_num_rows($result);
$arr = array();
if($datarow>0){
// $content = json_encode($_SESSION['username']);
// if($f = file_put_contents($file, $content,FILE_APPEND)){// 这个函数支持版本(PHP 5)
// //echo "写入成功。<br />";
// }
for($i = 0;$i < $datarow ; $i++){
$search_arr = mysqli_fetch_assoc($result);
$number = $search_arr['check_num'];
$password = $sreach_arr['check_pass'];
}
$arr['result'] = 1 ;
$arr['data'] = $password;
}else{
$arr['result'] = 0;
$arr['data'] = '验证码输入错误';
}
echo json_encode($arr);
}
$conn->close();
?>
三个问题
1. Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in G:\Wamp\wamp\www\electricmobile\check.php on line 27
2. Notice: Undefined index: number in G:\Wamp\wamp\www\electricmobile\check.php on line 24
3. Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in G:\Wamp\wamp\www\electricmobile\check.php on line
这是什么情况 为什么我一用mysqli_num_rows 就出错