integer numRows (
)
Get the number of rows in a result set.
For
ibase
,ifx
andoci8
, this method only works if the DB_PORTABILITY_NUMROWS portability option is enabled. In addition, foribase
andifx
, PEAR DB must be at version 1.7.0 or greater.Does not work for Microsoft Access.
integer - number of rows or a DB_Error object on failure
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. |
This function can not be called statically.
Using numRows()
<?php
// Once you have a valid DB object named $db...
$res =& $db->query('SELECT * FROM phptest');
echo $res->numRows();
?>