对于较少的行数,它可以很好地工作,但是在结果增加到8000行后,不返回任何内容
<?php
require("db_config.php");
$con=mysqli_connect($DB_SERVER,$DB_USER,$DB_PASSWORD,$DB_DATABASE);
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql = "SELECT stop_id, stop_code, stop_name from stops";
$result = mysqli_query($con, $sql);
echo $sql . mysqli_num_rows($result);
if(mysqli_num_rows($result) > 0) {
$response["stopnames"] = array();
while ($row = mysqli_fetch_array($result)) {
$item = array();
$item["stop_id"] = $row["stop_id"];
$item["stop_code"] = $row["stop_code"];
$item["stop_name"] = $row["stop_name"];
// push ordered items into response array
array_push($response["stopnames"], $item);
}
// success
$response["success"] = 1;
$response["msg"] = $sql;
}
else
{
// order is empty
$response["success"] = 0;
$response["msg"] = $sql;
}
// echoing JSON response
echo json_encode($response);
mysqli_close($con);
?>
结果: 从stop7618中选择stop_id,stop_code,stop_name 表示已提取约7618行,但未返回任何结果 对于结果中的行数较少,效果很好
答案 0 :(得分:0)
也许是由于最长执行时间或内存限制而终止了脚本。
开始添加
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
在回显json_encode($ response)之后添加类似内容
echo 'Stoped';
并检查是否将输出