Reputation: 4857
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.
Upvotes: 1
Views: 826
Reputation: 4857
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
Upvotes: 0
Reputation: 16603
do your SELECT command with LIMIT statement.
on first query you can get first 20 results, then next 20, etc.
Upvotes: 0
Reputation: 838156
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.
Upvotes: 1