Re: Fatal error: Call to undefined function: numrows() in ... - is thisa bug or just a typo in my script?
| From: | Peter | Date: | Thu, 08 Jan 2004 15:55:14 +0000 |
| Subject: | Re: Fatal error: Call to undefined function: numrows() in ... - is thisa bug or just a typo in my script? | ||
| References: | 1 | Groups: | php.pear.dev php.pear.general |
| Request: | Send a blank email to pear-dev+get-24895@lists.php.net to get a copy of this message | ||
Hi Leonard.
query() is probably returning a DBError. Here is some of my code which may be useful:
$var = $db -> query("SELECT...");
if (ifErrorEchoDo('Squawk: Select failed...',$var)
die('exiting due to error');
where..
function ifErrorEchoDo($mess,$res) {
if (DB::isError($res)) {
echo '<B>'.$mess.' '.
$res->getCode().' '.$res->getMessage().'</B> ';
/* Exlcude this line when live! */
echo '<BR>'.$res->userinfo.'<BR>';
return true;
} /* if */
else
return false;
} /* function */
Hope that helps!
Regards,
Peter
"Leonard Nino B. Natera" wrote:
>
> hi,
>
> i am new to pear and i like it because lesser code is written, but i had
> a problem with getting the number of rows returned, which says:
>
> Fatal error: Call to undefined function: numrows() in
> /usr/share/pear/.../myFile.php on line 80
>
> in my php.ini file i have already uncommented the include for unix and i
> added /usr/share/pear... it looks like this:
>
> include_path = ".:/php/includes:/usr/share/pear"
>
> now, myFile.php contains include_once(DB.php) above. i have connected
> successfully to my database and have inserted a row. when i used the
> SELECT statement in the query() function, i cannot verify the number of
> rows returned. all i get is the fatal error above.
>
> $var = $db -> query("SELECT...");
> if($var -> numRows() == 0) { // this is line 80
> // ... some php code
> }
>
> i tried to used a simple echo and i still got the error...
>
> $var = $db -> query("SELECT...");
> echo $var -> numRows(); // this is line 80
>
> is this a bug or have i just left something out?
>
> thanks...