Re: A sample of viewing 10 database entries with a next and prev function

From: Date: Fri, 18 Aug 2000 14:20:46 +0000
Subject: Re: A sample of viewing 10 database entries with a next and prev function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-12481@lists.php.net to get a copy of this message
You can do this, by passing the page number as the parameter. $start=$page * 10; "select * from table limit $start,10" First time the page will be 0 and will bring in first 10 records and create a link with the following condition if($page!=0): $n=$page-1; echo "<a href='page.php3?page=$n'>Prev</a>" else; echo "Prev"; endif $cnt="select count(*) from table" $tot=$page*10; if($cnt>$tot): $n=$page+1; echo "<a href='page.php3?page=$n'>Next</a>"; else: echo "Next" endif; This will do the job. Dennis van Zanten wrote: > Can someone give me a basic sample of reading the first 10 records of a database table with the > option of jumping to the next 10 record like a next and previous function.... > > Thanks for your help, > > Dennis van Zanten

« previous php.general (#12481) next »