#1
  1. No Profile Picture
    raghuram
    Guest
    Devshed Newbie (0 - 499 posts)
    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.

    Raghu.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    3
    Rep Power
    0
    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***
    echo mysqlresult($result,$index,'id');
    }
    [/code]

    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.

Similar Threads

  1. re: JSP page not displaying name
    By Internment in forum Java Help
    Replies: 3
    Last Post: February 18th, 2004, 04:03 AM
  2. Displaying records in between 2 fields
    By davecollier in forum ASP Programming
    Replies: 2
    Last Post: February 17th, 2004, 11:59 AM
  3. displaying mysql records (10 at a time) ?
    By tim0 in forum Perl Programming
    Replies: 10
    Last Post: January 29th, 2004, 01:48 AM
  4. page not displaying correctly in netscape 4.77
    By derrek in forum HTML Programming
    Replies: 4
    Last Post: January 13th, 2004, 04:42 PM
  5. page not displaying correctly in netscape 4.77
    By derrek in forum Beginner Programming
    Replies: 5
    Last Post: January 13th, 2004, 02:31 PM

IMN logo majestic logo threadwatch logo seochat tools logo