Re: DB stuff

From: Date: Tue, 07 Nov 2000 18:44:24 +0000
Subject: Re: DB stuff
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-24153@lists.php.net to get a copy of this message
There isn't any there. The only thing you get is files in the PEAR directory - you probably won't have access to it if you're using an ISP or shared server. Download the php.tar.gz stuff, open it, and look for a directory called 'PEAR'. I don't think there's all that much in the way of tutorials on using the PEAR stuff yet, but the files themselves seem to have a bit of documentation in the source code. If you understoof what was going on in Rasmus' example, you can probably figure out the PEAR stuff. Rouvas Stathis wrote: > Excuse me, where is the documentation for the DB abstraction layer? > I can't seem to find any in the > <http://www.php.net/manual>. > > Thank you for your time, > -Stathis. > > Rasmus Lerdorf wrote: > > > > PHP 4 comes with a database abstraction layer. You would use it like > > this: > > > > <? > > require_once 'DB'; > > $db = DB::connect('odbc://rasmus:pw@host/my_db'); > > $stmt = $db->prepare('select * from my_table'); > > $result = $db->execute($stmt); > > while($row = $db->fetchrow($result)) { > > while(list($key, $value) = each($row)) { > > echo "$field: $value<br>\n"; > > } > > } > > $db->disconnect(); > > ?> > > > > To change to a different database type the only thing you need to do is > > change the 'odbc' work in the DB::connect() call. > > > > You can of course read that database connection identifier string from > > anywhere you like and thereby configure your database access with a > > one-liner in any file you like. > > > > -Rasmus > > > > On Tue, 7 Nov 2000, Voitenko, Denis wrote: > > > I am wondering why wouldn't PHP support database connectivity like most > > > application servers do, e.g. something like a data source in JRun or > > > WebLogic where database connectivity is made DB server independent and all > > > the DB connectivity is configured in the guts of PHP? > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- ========================== Michael Kimsal http://www.tapinternet.com 734-480-9961

« previous php.general (#24153) next »