我的php mysqli查询代码工作正常,并按预期将结果返回给ajax,但在错误日志中,我得到了一些注释。我已经研究过先前的问题,但仍然不知道为什么会出现此错误。 但结果如预期般正常。
[Tue Mar 05 20:38:31 2019] [error] [client 110.225.81.22] mod_fcgid: stderr: PHP Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /home/www/getyourevisa.com/getcountry.php on line 14
这是我的getcountry.php页面代码
<?php
include "config.php";
$destid = $_POST['dest'];
$destnew = strtolower($destid);
$sql = "SELECT id,nicename FROM `".$destnew."`";
$result = mysqli_query($con,$sql);
$users_arr = array();
while( $row = mysqli_fetch_array($result) ){
$userid = $row['id'];
$name = $row['nicename'];
$users_arr[] = array("id" => $userid, "name" => $name);
}
echo json_encode($users_arr);
?>