Jul
29
2009

Adodb PHP simple access to MySql – Oracle – Interbase

PHP’s database access functions are not standardised. This creates a need for a database
class library to hide the differences between the different databases (encapsulate the
differences) so we can easily switch databases.

Requires PHP4. Based on the best ideas of PEAR, phpdb and Microsoft’s ADO.

MySQL Usage:

include('adodb.inc.php');
ADOLoadCode('mysql');
$conn = &ADONewConnection();
$conn->PConnect('localhost','userid','password','database');
$rs = $conn->Execute('select * from table');
rs2html($rs); /* recordset to html table */


Oracle Usage:

[php]
include(‘adodb.inc.php’);
ADOLoadCode(‘oracle’);
$conn = &ADONewConnection();
$conn->PConnect(”,’scott’,’tiger’);
$rs = $conn->Execute(‘select * from table’);
rs2html($rs); /* recordset to html table */
[/php]

Interbase Usage:

[php]
include(‘adodb.inc.php’);
ADOLoadCode(‘ibase’);
$conn = &ADONewConnection();
$conn->PConnect(‘c:\ibase\employee.gdb’,’sysdba’,’masterkey’);
$rs = $conn->Execute(‘select * from table’);
rs2html($rs); /* recordset to html table */
[/php]

http://php.weblogs.com/adodb

Written by doutdex in: Uncategorized | Tags: ,

No Comments »

RSS feed for comments on this post. TrackBack URL


Leave a Reply

%d bloggers like this: