简体   繁体   中英

Display sql results in groups

I have an sql query here and it returns a number of results. I'd like to show these results in groups.

What I mean is, show the first 20 results in some part of the page, show the next 20 results in another part of the page etc...

How can I do that?

*I'm using PHP to display results.

What you want is called pagination and the specific implementation depends on the database. For example, in MySQL you can use LIMIT a,b , and most other databases you can use either TOP(n) or ROW_NUMBER .

do your SELECT command with LIMIT statement.

on first query you can get first 20 results, then next 20, etc.

Ok I found a solution in a forum. It's here in case somebody else needs it

http://www.phpbuilder.com/board/showthread.php?t=10311631

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM