X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id DBD00D1C4DB for ; Fri, 8 Aug 2003 22:05:56 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 89776-02 for ; Fri, 8 Aug 2003 19:04:30 -0300 (ADT) Received: from seapdc01.PNTS (ip63.c216.blk1.bel.nwlink.com [209.20.216.63]) by svr1.postgresql.org (Postfix) with ESMTP id 6207AD1C4C8 for ; Fri, 8 Aug 2003 19:05:45 -0300 (ADT) Received: from busbydev (BUSBY-DEV [10.0.0.17]) by seapdc01.PNTS with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id PRCQ9P0P; Fri, 8 Aug 2003 15:22:31 -0700 Message-ID: <001301c35df8$4a5123d0$1100000a@busbydev> Reply-To: "David Busby" From: "David Busby" To: "Lynna Landstreet" , References: Subject: Re: Paging results Date: Fri, 8 Aug 2003 14:59:07 -0700 Organization: Pacific Northwest Ticket Service MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/31 X-Sequence-Number: 2208 Paging with PostgreSQL is super easy! select * from table where (x=y) offset 0 limit 30; Gives you the first 30 matches, then do select * from table where (x=y) offset 30 limit 30; This will give the next 30, super easy! Here's a sample of how I use it in a script // Collect offset $offset = isset($_GET['offset'])?$_GET['offset']:0; // Now the links for Prev/Next if ($offset >= 30) echo "|Back 30"; echo "|Next 30"; // Query $rs = pg_exec($db,"select id,name from stuff order by name offset $offset limit 30;"); /B ----- Original Message ----- From: "Lynna Landstreet" To: Sent: Friday, August 08, 2003 13:30 Subject: [PHP] Paging results > HI there, > > Thanks to everyone who helped with my keyword problem - I think I thanked > them all individually but I thought I should mention it here too. > > Now, a new question: > > Does anyone know if there's a PHP class anywhere out there for paging > results from a PostgreSQL query, similar to Paginator or ezResults which do > that for MySQL? Or do I have to do the code for that from scratch? > > Alternatively, would it be difficult to adapt one of those to working with > PostgreSQL instead of MySQL? > > > Lynna > -- > Resource Centre Database Coordinator > Gallery 44 > www.gallery44.org > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org