Re: abstraction for databases
| From: | Rasmus Lerdorf | Date: | Wed, 08 Nov 2000 20:39:45 +0000 |
| Subject: | Re: abstraction for databases | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-24369@lists.php.net to get a copy of this message | ||
There is a database abstraction layer in PHP. Here is a sample script:
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();
-Rasmus
On Wed, 8 Nov 2000, Sakalis Giorgos wrote:
> Does anyone knows why there is no abstarction for databases in PHP, but
> there are several functions for each database.
>
> I think a model as Microsoft' s ADO will make develpment and migration
> of an application very easy. All you have to do is to change the type of
> database. The code conserning the communication with databse remains the
> same..
>
> Sakalis Giorgos
>
>
> --
> 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
>