Re: DB error: $db->query('SELECT 1+1') called in function is thorwing error
| From: | l Burnerheimerton | Date: | Fri, 19 Aug 2005 17:49:24 +0000 |
| Subject: | Re: DB error: $db->query('SELECT 1+1') called in function is thorwing error | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20492@lists.php.net to get a copy of this message | ||
You're right, it rtpints nothing out. check.php has
sevceral functions on it. On efunction on that same
page makes the a call to $db and it works. That is
the really frustrating part.
Can you send $db to the function?
Anyway, I'd rather not do a global, so how do I do
call a "singleton function". Many thanks.
--- Justin Patrin <papercrane@gmail.com> wrote:
> On 8/19/05, l Burnerheimerton
> <lburnerheimerton@yahoo.com> wrote:
> > I have code that calls a function. In that
> function,
> > I have labored several hours trying to see WHY
> it's
> > throwing an error. I'd like a second, or third
> pair
> > of eyes to help. I have narrowed it down to its
> > essential, I think, a very simple example.
> >
> > The error is:
> > Fatal error: Call to a member function on a
> non-object
> > in C:\...\check.php line 34
> >
>
> Are you perhaps....calling a member function on a
> non-object? Try
> print_r($db); I bet you get no output. Are you
> trying to access a
> global variable in a function? If so, use a
> singleton function or
> $GLOBALS['db'].
>
> --
> Justin Patrin
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com