Re: Limits and PHP

From: Date: Thu, 11 Apr 2002 12:19:02 +0000
Subject: Re: Limits and PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-92548@lists.php.net to get a copy of this message
ok, if you're using mysql you can use the LIMIT function in your statement: SELECT * FROM table LIMIT 0, 30 would show 30 rows starting from row 1. you can set a variable telling your php script how many entries per page you will show: $showlines = 10; and telling your script where to start the search $start = ($page * showlines) - $showlines; and you're sql should look like: SELECT * FROM table LIMIT $start, $showlines so if you're on page 3, it'll look like this: $start = (3 * 10) - 10 // 20 is our startpoint SELECT * FROM table LIMIT 20, 10 this would show 10 lines starting from line 21 "Chuck "Pup" Payne" <cepayne@magidesign.com> schrieb im Newsbeitrag news:B8DAF0B4.F087%cepayne@magidesign.com... > Hi, > > I would to know what is a good example of how to use limits within PHP. I > have an SQL statement that looks at a database and pulls from it and all > items in it, but like to be able to show let said ten items on one page then > you press like to get the next twenty and so and so until there is no more. > Is this hard to do? > > > Chuck >

« previous php.general (#92548) next »