Links script

From: Date: Sun, 07 Jan 2001 21:00:32 +0000
Subject: Links script
Groups: php.general 
Request: Send a blank email to php-general+get-33118@lists.php.net to get a copy of this message
Hey there, I am currently writing a links script which I'd like to list links stored in a MySQL database. Links can be submitted by the client, etc etc. That's not where my problem lies. At the moment we limit the client to 20 links per page. So, when thre links database reaches over 20 links, I'd like the first page to display the last 20 links (added by date), and then automatically insert a "Next page" link, which will take you to another page with the next 20 links. If the links amount to 40 or more, I'll need a "Back button" to take them back through the pages. I am garbling. Bah. Basically, what I guess I am asking is, how do I get the links pages to read rows from the database in chunks of 20? I know it'll be using LIMIT, but I don't want to have to write into the links script a load of if statements (I'm not too hot on For and While statments yet) which read <? if ($num_rows > 20) { echo "<a href=\"links.php?limit21,40\">Next 20 links</a>" } ?> etc etc. Sorry for the useless explanation, but hopefully one of you will gather roughly what I am saying. Thanks, James.

« previous php.general (#33118) next »