View Full Version : Limiting the number of database entries shown..

07-10-2004, 08:45 PM
i have a database at http://www.startbar.co.uk/coursemanager/courses.asp

it shows a list of course entries.

how can i create a seperate section to go on another page with the 'next five courses' so it will only show the next 5 entries?

like a 'headlines' system on a news script.


07-11-2004, 11:50 AM
run a google or a search here or at www.hotscripts.com for 'recordset paging' or 'pagination'. Plenty of tutorials and examplecode for whatever db-format you are using, will popup

07-12-2004, 09:20 PM
actaully i meant like just showing the first five entries of a database.

i ie..

list of ten

1 to 10

and ONLY showing 1, 2, 3, 4, 5

and thats it. the first five!

any ideas?

07-12-2004, 09:37 PM
i don't realy understand it and you probably didn't look up recordset paging, because with recordsetpaging, you do exactly the same. Only the ofset will be different. If you just need t first 5, then all you need is
(for Jet DB's --> access or ms server)
select top 5 your variables from table order by tablesautonumcolumn asc
(for MySQL)
select your variables from table order by tablesautonumcolumn asc
limit 5

tablesautonumcolumn should be replaced by whatever columns you want to sort on.

Note: TOP does not discriminate ! So if your values (from tablesautonumcolumn) are 1,2,3,4,5,5,5,5,5,5,,5,5,5,5,5,5,5,5,5,5,5,6,6,6,7,7,7

then TOP 5 would include 1,2,3,4,5,5,5,5,5,5,,5,5,5,5,5,5,5,5,5,5,5
LIMIT 5 would just return 1,2,3,4,5