zekia
zekia

Reputation: 4857

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.

Upvotes: 1

Views: 826

Answers (3)

zekia
zekia

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

Axarydax
Axarydax

Reputation: 16603

do your SELECT command with LIMIT statement.

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

Upvotes: 0

Mark Byers
Mark Byers

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

Related Questions