Re: breaking up images to sets of 5

From: Date: Wed, 07 Feb 2001 01:21:00 +0000
Subject: Re: breaking up images to sets of 5
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-38467@lists.php.net to get a copy of this message
enthalpy wrote: > > i use mysql to store urls for all my images and have php query that for > the images. is there an easy way to set it up so it does 5 at a time and > has a lil next 5 link at the bottom.. the entriees in the table are not > numbered. Append your SQL query with LIMIT $edge, $limit"; ie "SELECT blah from stuff LIMIT 0,5"; select the first ten images. The next ten would be as such "SELECT blah from stuff LIMIT 5,5"; For a link to the next 5, or previous 5 for example..do something like this: # Prints the previous 5 (if they exist!) if($edge >= $limit) { $edge = $edge - $limit; echo "<a href=\"http://blah/script.php?limit=$limit&edge=$edge"> Previous Ten</a>"; } # Prints the next 5.. $edge = $edge + $limit; if($count > $edge) { echo "<a href=\"http://blah/script.php?limit=$limit&edge=$edge"> next Ten</a>"; } Sorry its a bit rough :) Hope you get the general idea :) ^^@rk << If I was a signature file, where would I be?? >>

« previous php.general (#38467) next »