Re: numRows() trouble....
| From: | Cory Hicks | Date: | Mon, 03 Feb 2003 22:33:13 +0000 |
| Subject: | Re: numRows() trouble.... | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-3592@lists.php.net to get a copy of this message | ||
Dave,
This did the trick....since I am using mysql, I am reading up on the
differences in the simpleQuery vs. query.
Here is how the code looks now:
<snip>
$query = "SELECT * FROM users";
$result=$db_obj->simpleQuery($query);
if (DB::isError($result))
die($result->getMessage());
$result_num=$db_obj->query($query);
$num = $result_num->numRows();
while ($rows = $db_obj->fetchRow($result,DB_FETCHMODE_ASSOC))
{
$ctr++;
</snip>
Thanks again!
Cory
On Mon, 2003-02-03 at 15:35, Dave Morris wrote:
> Hey Cory,
> Not sure if this will do anything, but here goes. Try
>
> $result = $db_obj->query($query);
>
> instead. usually when I get that error it is because my mysql statement
> is faulty. however "SELECT * FROM users" seems pretty straightforward
> given that 'users' exists. Hope this helps.
>
> -dave
>
>
> On Mon, 3 Feb 2003, Cory Hicks wrote:
>
> > Hello again....
> >
> > Thanks to the list for the recent help! I am now moving onto other cool
> > PEAR features, but seem to be having problems with numRows(). I keep
> > getting this error:
> >
> > Fatal error: Call to a member function on a non-object
> >
> > Here is the code:
> >
> > $query="SELECT * FROM users";
> >
> > $result=$db_obj->simpleQuery($query);
> >
> > if (DB::isError($result))
> > die($result->getMessage());
> >
> > $num = $result->numRows();
> >
> > What I am missing?
> >
> > Thanks,
> >
> > Cory
> >
> >
> > --
> > Cory Hicks <chicks@tri-intl.com>
> > TRI-International
> >
> >
> > --
> > PEAR General Mailing List (http://pear.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
--
Cory Hicks <chicks@tri-intl.com>
TRI-International