Re: DB stuff
| From: | Rasmus Lerdorf | Date: | Tue, 07 Nov 2000 20:03:06 +0000 |
| Subject: | Re: DB stuff | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-24155@lists.php.net to get a copy of this message | ||
The DB class is part of PEAR and the documentation has not been integrated
with the online manual yet. The class is documented inline in the code
itself and tools are in the works that will get this integration done.
For now, the easiest thing to do is to simply read through pear/DB.php in
your php source directory.
-Rasmus
On Tue, 7 Nov 2000, 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
>