db2_num_rows() should return the number of rows in the select IF you are using a scrollable cursor. But you will probably find that the select count(*) approach is faster (unless you are using a scrollable cursor for other reasons).

Regards

Paul Tuohy
ComCon
www.comconadvisor.com www.systemideveloper.com




Kelly Cookson wrote:
If you're using the db2_ functions, you can use db2_num_rows to get the number of rows deleted, inserted, or updated by an SQL statement.

Use SELECT COUNT(*) to get the number of rows returned by a select statement.

See the PHP manual for more info and examples: http://www.php.net/manual/en/function.db2-num-rows.php

Kelly


-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Larry Kleinman
Sent: Tuesday, December 15, 2009 8:32 AM
To: Web Enabling the AS400 / iSeries
Subject: [WEB400] getting number of records returned by SQL in PHP

Hi all - net.data has a nice feature called TOTAL_ROWS which gives the total number of rows returned by a SQL query. Is there something similar in PHP?


Larry Kleinman
Kleinman Associates, Inc.
212-949-6469
203-255-4100

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.