如何在不考虑 PDO 限制的情况下获取找到的总行数?
本文介绍了如何在不考虑 PDO 限制的情况下获取找到的总行数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发现为了显示加载更多按钮而进行辅助查询以检查更多结果非常不专业.
我正在使用 PDO,有什么方法可以在没有限制过滤器的情况下获得找到的总行数,但仍然过滤结果?
当前代码:
解决方案
MySQL only AFAIK:
对于数据库服务器来说,当然与查询所有记录的时间一样繁重.对于非 MySQL 使用,此查询当然比获取所有记录的行数要好:
I found it very unprofessional to make a secondary query to check for more results in order to display a load more button.
I'm using PDO, is there any way to get the total found rows without the limit filter but still filtering the results?
Current Code:
解决方案
MySQL only AFAIK:
About as heavy for the database server as querying a single time for all the records of course. For non-MySQL use, this query is of course better then getting the rowcount of all the records:
这篇关于如何在不考虑 PDO 限制的情况下获取找到的总行数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!