Re: Navigation through DB Queries

From: Date: Sat, 28 Oct 2000 02:52:21 +0000
Subject: Re: Navigation through DB Queries
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-22408@lists.php.net to get a copy of this message
Just off the top of my head I might put some type of counting field in the actual database that increments itself everytime you add a record. Then it is a simple matter of writing some function to subtract out whatever you want the max number of records to be ex. $num = $num - $y; if( $num >= 0) // dont display a previous $num2 = $num2 - $y; if($num <= // max number of records) // dont display next Then you could right some other check to make sure that there are another 50 items in the database and if not just display the remaining records. I am sure that this method has some errors in it I might be overlooking but I hope that this will get you started. Nashirak "Phillip S. Baker" wrote: > Okay I am pulling x number of records from a DB and displaying them. > And I want to display only 50 of those records on a page. > I get setting something like an $x and $y variable $x = 0 $y = 50 > SelectStmt = "....Limit $x,$y" > > Now at the bottom of the page I want to create a navigation so the user can > click on over to the next 50 records or back to the previous 50 records. > How would I write something like this? > > Thanks in advance. > > Phillip S. Baker > > phillip@wordsandimages.com > Words & Images > 1535 Seabright Avenue, Suite 100, Santa Cruz, CA 95062 > Direct Line (831) 420-2641 / Fax (831) 458-0808 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#22408) next »