Hi,
I have read the latest presentation by Rasmus Lerdorf about PHP , in which he mentions about Database Abstraction Layers(similar to perl's DBI or Microsofts ODBC) ..
it says something like this(with Example)
A database abstraction layer is bundled with PHP 4. In the example below, the only thing you would need to change to use a different
database is the odbc word on the third line.
<?php
require_once*'DB.php';
$db*=*DB::connect('odbc://userw@host/mydb');
**$stmt*=*$db->prepare('SELECT***FROM*comments');
**$result*=*$db->execute($stmt);
**while($row*=*$db->fetchrow($result))*{
*****while($row*as*$field*=>*$value*)*{
********echo*"$field:*$value<br>\n";
*****}
**}
**$db->disconnect();
?>
does he mean to say that if i change odbc to mysql in the above code i will be able to change my database to mysql and there is no need to change other code which i have already written. if it is so .. can someone tell me more about this feature or any open source links from where i can get more information (or the link from where i can download the file DB.php mentioned in the code segment above).
Thanks in Advance,
Danny ....
I have read the latest presentation by Rasmus Lerdorf about PHP , in which he mentions about Database Abstraction Layers(similar to perl's DBI or Microsofts ODBC) ..
it says something like this(with Example)
A database abstraction layer is bundled with PHP 4. In the example below, the only thing you would need to change to use a different
database is the odbc word on the third line.
<?php
require_once*'DB.php';
$db*=*DB::connect('odbc://userw@host/mydb');
**$stmt*=*$db->prepare('SELECT***FROM*comments');
**$result*=*$db->execute($stmt);
**while($row*=*$db->fetchrow($result))*{
*****while($row*as*$field*=>*$value*)*{
********echo*"$field:*$value<br>\n";
*****}
**}
**$db->disconnect();
?>
does he mean to say that if i change odbc to mysql in the above code i will be able to change my database to mysql and there is no need to change other code which i have already written. if it is so .. can someone tell me more about this feature or any open source links from where i can get more information (or the link from where i can download the file DB.php mentioned in the code segment above).
Thanks in Advance,
Danny ....