June 10th, 2000, 01:39 AM
I'm having many records in my MySQL table. I want to display 10 records per page.
Can anyone suggest me how to do it.
June 10th, 2000, 06:38 AM
I have done this before, using somthing along the lines of the following:
if you're using a while loop, try replacing it with a for loop, along the lines of:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
for($index=$startpos;($index<$num_rows && $index<$(startpos+10));$index++)
***code for output goes here, eg***
where $startpos is the position to start (0 for first 10 displayed, 10 for next ten), $num_rows is the number of results found from the database. Startpos can be passed to the page through a get field (ie http://...?startpos=10)
the next page of results would be startpos+10, previous startpos-10 (obviously you would need to check these exist
hope that helps, Daniel.