Re: Need Help For MySQL/PHP
| From: | David Hedbor | Date: | Tue, 21 Dec 1999 09:11:46 +0000 |
| Subject: | Re: Need Help For MySQL/PHP | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-13894@lists.php.net to get a copy of this message | ||
php <phplist@johnpacific.net> writes:
> Hi,
>
> I am writing my scripts in php3 using mySQL as backend.
>
> I have around 80-100 records in a table and I want to display
> 10 records at a time on the browser screen in a loop.
>
> How should I write the code for this?
>
> Please help me out. Looking for a kind response.
You do this using the LIMIT option to your select. Basically you do a
query like this:
SELECT * FROM mytable LIMIT 0,10
Then simply keep a counter. You can make a link that looks like this
for example:
http://thesite/thepage.php?n=10
Then the next query, use the above variable:
SELECT * FROM mytable LIMIT 10,10
Add 10 to the variable, and the next link will be n=20 and so on.
See the following URL for the docs:
http://www.mysql.org/Manual_chapter/manual_Reference.html#SELECT
--
[ Below is a random fortune, which is unrelated to the above message. ]
And it should be the law: If you use the word `paradigm' without knowing
what the dictionary says it means, you go to jail. No exceptions.
-- David Jones