Another option depending on what you're doing with the results is to loop
   the records into an array. You can then work with the result set using
   array functions like count( ) and slice( ). YMMV.
   
http://us2.php.net/manual/en/book.array.php
   --
   Alfredo Delgado / Web Development
   6800 Broken Sound Pkwy, Suite 150
   Boca Raton, Florida 33487
   (561) 443-9152 - Desk
   (561) 350-4143 - Cell
   (561) 443-9108 - Fax
   -----web400-bounces@xxxxxxxxxxxx wrote: -----
     To: Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>
     From: Nathan Andelin <nandelin@xxxxxxxxx>
     Sent by: web400-bounces@xxxxxxxxxxxx
     Date: 12/15/2009 11:19
     Subject: Re: [WEB400] getting number of records returned by SQL in PHP
     I think you'll be pleased with the performance of select count(*) for
     most result sets, even though it would be running a two select
     statements.  That may be what net.data is doing under the covers, too.
      You and your users can decide whether the added overhead is worth it.
     Nathan.
     ----- Original Message ----
     From: Larry Kleinman <larry@xxxxxxxxxxxxxxxxx>
     To: Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>
     Sent: Tue, December 15, 2009 8:52:47 AM
     Subject: Re: [WEB400] getting number of records returned by SQL in PHP
     Unless I do a GROUP BY (which I do not want to do), I don't think that I
     can use the SELECT COUNT(*) and also get the actual fields returned in a
     single SQL query, can I?  That would mean that I would have to run the
     query twice, once to get the data and once to get the count.  Not a
     great
     thing to do from a performance point of view
     Larry Kleinman
     Kleinman Associates, Inc.
     212-949-6469
     203-255-4100
     --
     This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
     To post a message email: WEB400@xxxxxxxxxxxx
     To subscribe, unsubscribe, or change list options,
     visit: [1]
http://lists.midrange.com/mailman/listinfo/web400
     or email: WEB400-request@xxxxxxxxxxxx
     Before posting, please take a moment to review the archives
     at [2]
http://archive.midrange.com/web400.
References
   Visible links
   1. 
http://lists.midrange.com/mailman/listinfo/web400
   2. 
http://archive.midrange.com/web400
As an Amazon Associate we earn from qualifying purchases.