RE: [PHP-DB] Limit in SELECT query.

From: Date: Fri, 24 Nov 2000 16:10:06 +0000
Subject: RE: [PHP-DB] Limit in SELECT query.
Groups: php.db 
Request: Send a blank email to php-db+get-4725@lists.php.net to get a copy of this message
I usually do something like this # $page passed in the URL $limit = 10; $offset = ($page - 1) * $limit; $sql = "SELECT fields FROM table LIMIT $offset, $limit"; I hope that helps. Ollie > -----Original Message----- > From: Mircea Romanitan [mailto:mitch@lasting.ro] > Sent: 24 November 2000 15:58 > To: php-db@lists.php.net > Subject: Re: [PHP-DB] Limit in SELECT query. > > > Thanks Ollie. > > But what if i want to make something like: > > prev 1 2 3 4 next total records: 45 > > and each number to be a link to that group of 10 records ? > Must i first get the number of all records, and then query > again the DB with > that limit ? > > Thankx > > ----- Original Message ----- > From: <o.cook@etoncollege.org.uk> > To: <mitch@lasting.ro> > Cc: <php-general@lists.php.net> > Sent: Friday, November 24, 2000 5:41 PM > Subject: RE: [PHP-DB] Limit in SELECT query. > > > SELECT fields FROM table WHERE field=condition LIMIT 0,10 > > ... to get 10 records. > > Ollie > > > -----Original Message----- > > From: Mircea Romanitan [mailto:mitch@lasting.ro] > > Sent: 24 November 2000 15:32 > > To: php-db@lists.php.net > > Subject: [PHP-DB] Limit in SELECT query. > > > > > > Hello. > > > > Can someone give me an example of SELECT query with limit? > > > > Thanx. > > > > Mircea > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net >

« previous php.db (#4725) next »