Re: Re: [PEAR] DB error: $db->query('SELECT 1+1') called in function is thorwing error
| From: | Justin Patrin | Date: | Fri, 19 Aug 2005 18:10:58 +0000 |
| Subject: | Re: Re: [PEAR] 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-20496@lists.php.net to get a copy of this message | ||
On 8/19/05, l Burnerheimerton <lburnerheimerton@yahoo.com> wrote:
> I just learned and tested that I CAN pass $db by
> reference. And that worked.
>
> Is there any reason I should NOT do it this way?
>
> I do use that $db later in the calling page's code.
>
Passing it in by ref is ok, but if you're doing this a lot you may
want to look into creating an object and having the DB instance as a
member variable in it to save you from having to pass in the db
everywhere.
Search the archives, some singleton functions for DB were posted a while back.
--
Justin Patrin