douou8954 2014-04-09 20:04
浏览 37
已采纳

MySQL PHP继续超越LIMIT的结果

I require to output only 35 results per tab within a JQuery UI.

Each Tab shall represent a page of 35 results by increment.

JQuery Tab UI Example

I am not entirely familiar with the use of LIMIT and thus far i cannot seem to understand the correct way to utilize its function to achieve my desired result perhaps solely within a degree of my urge to ensure efficiency but nonetheless i would like to learn about the possibilities.

I have a MySQL Query as follows:

 $sql13x = " SELECT * 
                FROM item_groups 
                    WHERE section_id='$item_sec_id' 
                    AND item_sub_sec_id='$item_sub_sec_id' 
                    ORDER BY item_id ASC LIMIT 35"; 

From this point i am able to acquire 35 results, but how do i commence beyond that? Baring in mind each 35 results is responsible for creating the tab as well as the div below holding the results.

Is there an ability to continue a query beyond where you stopped previously? Or do i have to make a count with PHP and resend the query removing the total number of results counted?

Even though i could achieve the desired result, this is a query of the "right" way to achieve the result, either through efficiency and or dynamic ability. Also in general to learn if i am missing something.

  • 写回答

1条回答 默认 最新

  • doulu7921 2014-04-09 20:08
    关注

    Limit can take two arguments, the starting point and the total amount. So for instance LIMIT 0,35 starts at the first record and returns 35 records. If you want records 36-70, do LIMIT 35,35. Then limit 70,35 and so on.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?