Retrieving the results can be LIMITed to X results starting at row Y using mysql's LIMIT function.

Check the MySQL manual, but basically, this will limit the result to 10 rows, starting with row 5.

SELECT name FROM customers LIMIT 5,10


By taking your values for the starting point and row count from variables from within the url, a posted form, session, cookie, etc, you can build dynamic queries, eg:


$sql = "SELECT name FROM customers LIMIT {$start},{$perPage}";


You can also build next and previous links by adding and subtracting the $perPage to the $start.



Make sense?



There's plenty of tutorials -- just do a google search.



Justin




On Sunday, July 20, 2003, at 05:55 PM, Aaron Axelsen wrote:


-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Hello,

I am currently trying to think of how I want to solve an issue, and
im looking for some input.

I have a page that will query information from a database and then
properly display it on the screen.  Now the thing I want to set up is
the option to split the information over 2,3 or more pages.

For example, the user can set a value in the config file for how many
results to display for page, then on each page ill have something
that says results 25-50 here and what not.

The only thing that comes to my mind, is somehow setting up some
tests, and then altering the sql statement with the list option.  Is
this the best way to do this?  Does anyone else have any other
suggestions??

Thanks in advance for the assistance.

- ---
Aaron Axelsen
AIM: AAAK2
Email: [EMAIL PROTECTED]

Want reliable web hosting at affordable prices?
www.modevia.com

Web Dev/Design Community/Zine
www.developercube.com


-----BEGIN PGP SIGNATURE----- Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPxpK1brnDjSLw9ADEQK0cQCgmFLBwO/IeqIYZIJUhR2j23Na5/sAniYv
nXehy/vKSs6AE8/yI3O9BixJ
=s7G2
-----END PGP SIGNATURE-----



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

---
[This E-mail scanned for viruses]




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



Reply via email to