NYCPHP Meetup

NYPHP.org

[nycphp-talk] Pear DB in another class

Russ Demarest rsd at electronink.com
Tue Mar 21 13:57:46 EST 2006


Forget it.
A singleton works.

Thanks anyway.


On Mar 21, 2006, at 1:38 PM, Russ Demarest wrote:

> Is it possible to use Pear DB in a class that returns a database
> handle that I can then run queries with.
>
> I think it should look something like this
>
> == myDb.php ==
>
> require_once 'DB.php';
>
> class myDb extends DB {
>
> 	function myDb(){
>
> 		$dsn = "mysqli://user:pass@localhost/db";
> 		$db = DB::connect();
>
> 	}
> }
>
>
> ===EOF===
>
> I can do an include that generates a handle but thought there would
> be a way to write a class that could grab the config info and  
> connect().
>
> Thanks,
> 	Russ
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> New York PHP Conference and Expo 2006
> http://www.nyphpcon.com
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>




More information about the talk mailing list