pear NumRows

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


i'm using pear (for the first time). the function "numRows" (Win XP
SP2 , IIS, MS ACCESS) gives me always the value "-1" (= the
ErrrorObject) - although the
sqlResult contains data.
I have to check the number of  rows before I use the sqlResult. How do
I get the numbers of rows?

Something like this:
while($row = $objSQLResult->fetchRow())
works fine, but when I want to use the sqlResult again,it seems to be

What can I do?

Thank you,

Re: pear NumRows

Robert Fritz wrote:

Quoted text here. Click to load it

   PEAR is a repository.  What are you actually using?  The DB package?
   How are you using numRows()?  It should be used something like this:

   $res =& db->query("select * from foo");
   $no_rows = $res->numRows();

   You might want to start adding error checks into your code, a la the:

   if (PEAR::isError($res)) {


Site Timeline