Re: PEAR DB problem
| From: | Markus Wolff | Date: | Mon, 03 Feb 2003 13:20:38 +0000 |
| Subject: | Re: PEAR DB problem | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-3574@lists.php.net to get a copy of this message | ||
Am Mon, 3 Feb 2003 13:47:51 +0100 (CET) schrieb Hrabcak Rado <hrabcak@phf.euke.sk>:
> I'm trying to do this:
> I have my own class. I want to use PEAR::DB object in it, which i create
> in constructor. But it doesn't work as I expected.
>
> Here I have links to examples:
>
> http://duffy.sk/test/code.phps
Haven´t looked at the other two, but you´re doing the object creation
wrong. This is what you do:
$this->db = new DB;
$this->db->connect("pgsql://user@localhost/hrabcak",true);
..and this is what you´re supposed to do:
$this->db = DB::connect("pgsql://user@localhost/hrabcak",true);
With "new DB" you just get an object of the generic DB base class,
which doesn´t do a lot. Using the factory method DB::connect() gives
you an object of a driver class specific to the database you´re using
(in this case, PostgreSQL).
Regards,
Markus
--
*21st Media* | Consulting, Konzeption, Produktion für die Bereiche:
Markus Wolff | Internet, Intranet, eCommerce, Content Management,
Hamburg,Germany | Softwareentwicklung, 3D-Animation, Videostreaming
http://21st.de | Tel. [+49](0)40/6887949-0, Fax: [+49](0)40/6887949-1