SELECT * FROM `news`
WHERE `deleted` = '0'
ORDER BY `time` DESC
LIMIT $START, $END
当LIMIT = 0,10时,它加载良好.
当LIMIT为10,20时,它的载荷很好.
当LIMIT为20,30时,它再次加载已在20,30中显示的最后4行……
解决方法:
你使用LIMIT的方式是不正确的.不是,
LIMIT
反而,
LIMIT
The first argument specifies the
offset of the first row to return, and
the second specifies the maximum
number of rows to return.
所以,例如,
... LIMIT 0, 10 -- first 10 rows
... LIMIT 10, 10 -- rows 10-20
... LIMIT 10, 20 -- rows 10-30, not 10-20
... LIMIT 20, 30 -- rows 20-50, not 20-30
如果结果集中没有足够的行来填充限制,它将返回到最后一行.例如,如果您只检索15行,则… LIMIT 10,10将返回10-15行.
标签:offset,php,mysql,limit
来源: https://codeday.me/bug/20190723/1516299.html