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" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> 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
> you press like to get the next twenty and so and so until there is no
> Is this hard to do?
> Chuck

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to