Re: Passing database resource to object (OO)
| From: | Curt Zirzow | Date: | Mon, 11 Aug 2003 19:23:10 +0000 |
| Subject: | Re: Passing database resource to object (OO) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159180@lists.php.net to get a copy of this message | ||
* Thus wrote Ben Edwards (ben@videonetwork.org):
> Wan I insatiate an object I want to pass a database resource that can be
> used throughout the object. The below code should indicate what I want but
> I get the error "mysql_query(): supplied argument is not a valid MySQL-Link
> resource". I guess this is because "$this->$db = $db" is wrong.
When referencing 'this' vars you dont use the $ on the var, instead
use:
$this->db = $db;
Curt
--
"I used to think I was indecisive, but now I'm not so sure."