php - 从 MySQL 服务器选择 4,000 行时出错

标签 php mysql mysqli server web-hosting

当我尝试这个循环超过 3 次时发生错误。 我正在尝试将此数据加载到网页中的 HTML 表格 View 中

$offset=0;
for ($i = 0; $i < 5; $i++) {
    $offset = ($i * 1000);
    if ($i == 0) {
        $offset = "";
    }
    unset($stmt); unset($products);
    $query=("SELECT * FROM tbldata A order by A.no asc limit ".$offset.",1000");
    $results = $mysqli->query($query);
}

Error occurred when i tried this loop more than 3 times

最佳答案

这就够了

$offset = $i * 1000;

删除:

$offset = ",".($i * 1000);
    if ($i == 0) {
        $offset = "";
    }

替换:

$query=("SELECT * FROM tbldata A order by A.no asc limit ".$offset.",1000");

与:

$query="SELECT * FROM tbldata A order by A.no asc limit ".$offset.",1000";

关于php - 从 MySQL 服务器选择 4,000 行时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38436272/

相关文章:

php - mysql db 结果转换为 json 数组

php - $_FILES 上传时为空

mysql获取相对于另一个值在给定条件下不存在的行

php - 从 MySQL 中选择多行

php - mysqli_stmt_bind_param : type mismatch do not raise error

php - 从 swf 生成图像

php - 使用 Facebook PHP SDK 获取用户电子邮件的权限

MySQL 主键区分大小写

php - 使用 php for 循环动态输入名称

php - php mysql 中的UTF8