dtz33344 2013-10-31 11:47
浏览 15

如何使用PHP获取每页的列数? [关闭]

I am developing a report using php and mysql. My problem is that i want to display a sum of columns data on per page like the following format.

Page 1 of 3
-------------------
col1 | col2 | col3|
-------------------
abc   100.01|15.20|
abc   200.05|20.20|
-------------------
sum  |300.06|35.40|

page 2 of 3

-------------------
col1 | col2 | col3|
-------------------
abc   100.01|15.20|
-------------------
sum  |100.01|15.20|

and so on.....

  • 写回答

3条回答 默认 最新

  • douxiajia6720 2013-10-31 11:50
    关注

    Try with LIMIT that includes with offset of the current page like

    SELECT SUM(col2),SUM(col3)
    FROM myTable
    LIMIT offset,limit
    

    And foreach page offset will be changed.

    评论

报告相同问题?