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

Error occurred when i tried this loop more than 3 times. I am trying to load this data into a HTML Table view in my webpage

$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

This is enough

$offset = $i * 1000;

Remove :

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

Replace :

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

with :

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