previousDB_result::numCols() (Previous) (Next) DB_Errornext

View this page in Last updated: Tue, 02 Jun 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

DB_result::numRows()

DB_result::numRows() – Gets number of rows in a result set

Synopsis

integer numRows ( )

Description

Get the number of rows in a result set.

For ibase, ifx and oci8, this method only works if the DB_PORTABILITY_NUMROWS portability option is enabled. In addition, for ibase and ifx, PEAR DB must be at version 1.7.0 or greater.

Does not work for Microsoft Access.

Return value

integer - number of rows or a DB_Error object on failure

Throws

Possible PEAR_Error values
Error code Error message Reason Solution
DB_ERROR_NOT_CAPABLE DB backend not capable Driver doesn't support this feature. Either switch to another database system or enable the DB_PORTABILITY_NUMROWS portability option.

Note

This function can not be called statically.

Example

Using numRows()

<?php
// Once you have a valid DB object named $db...
$res =& $db->query('SELECT * FROM phptest');
echo 
$res->numRows();
?>
previousDB_result::numCols() (Previous) (Next) DB_Errornext

Download Documentation Last updated: Tue, 02 Jun 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.