By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,045 Members | 1,372 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,045 IT Pros & Developers. It's quick & easy.

pear NumRows

P: n/a
Hello,

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:
-------------------------------------------------
$intCounter=0;
while($row = $objSQLResult->fetchRow())
$intCounter++;
-------------------------------------------------
works fine, but when I want to use the sqlResult again,it seems to be
empty.

What can I do?

Thank you,
Robert
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Robert Fritz wrote:
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:
-------------------------------------------------
$intCounter=0;
while($row = $objSQLResult->fetchRow())
$intCounter++;
-------------------------------------------------
works fine, but when I want to use the sqlResult again,it seems to be
empty.

What can I do?


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)) {
die($res->getMessage());
}

/Marcin
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.