douchunxian9740 2013-09-24 11:13
浏览 6
已采纳

确定分页期间不需要的页面

I am trying to implement pagination.The query,shown below,is used to get the the required no of rows to display per page and also filter some data . The problem is that since i am filtering data in the same query,I am unable to determine the no of pages for the pagination part .

What is the best way to go filter the data as well as know the no of pages required.

$query =   "SELECT c.id AS c_id, v_id, first_name, middle_name, last_name, email
                    FROM  `c` ,  `v`
                    WHERE closed =  'n'
                    AND c.v_id = v.id AND (" . $like_string . ")
                    ORDER BY c.id
                    LIMIT $open_startlimit , $data_perPage";
  • 写回答

1条回答 默认 最新

  • dregvw1801 2013-09-24 11:20
    关注

    Create another query which gets all the rows, and use the row count from that.

    $query =   "SELECT c.id FROM c, v WHERE closed = 'n' AND c.v_id = v.id AND (" . $like_string . ")";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿