php + MySQL question

G

Guest

Guest
Hello
Ihave a table in mysql database which has for example 50 records.
This is too much to show them in a single page. I want to show them 5 by 5. For example on the first page I show the first 5 records and button "NEXT" and when the user clicks it I show the second 5 records and a button "NEXT" and button "PREVIOUS".
Do you know how to do this ?

Thanks in advance
 
in a mysql query you can use "LIMIT 0,5"at the end of the query to limit the number of results.

LIMIT 0,5 means: return 5 records starting from position 0

make a next-button in wich you transfer the current limit variables to the same page and change you're query that way. So by clicking next a couple of times you're query may look like "select * from table LIMIT 15, 5;"

Greetz Daan
 
Back
Top