ADOdb is a database abstraction library for PHP. There is also a Python version; see the ADOdb for Python docs.
The PHP version currently supports an amazing number of databases, thanks to the wonderful ADOdb community: MySQL, PostgreSQL, Interbase, Firebird, Informix, Oracle, MS SQL, Foxpro, Access, ADO, Sybase, FrontBase, DB2, SAP DB, SQLite, Netezza, LDAP, and generic ODBC, ODBTP. The Sybase, Informix, FrontBase and PostgreSQL, Netezza, LDAP, ODBTP drivers are community contributions. Here is the complete list of drivers.
Many popular web applications such as ACID, Zikula/PostNuke, Xaraya, phpWiki, Mambo, PHP GACL, TikiWiki, eGroupWare and phpLens App Server are using ADOdb as their database abstraction layer. Some reasons why ADOdb is popular include:
PHP Code Samples
Other things you can try include:
# Updating tables $ok = $DB->Execute("update table set col1=? where key=?",array($colval, $key)); # retrieving data shortcuts $val = $DB->GetOne("select col from table where key='John'"); $row = $DB->GetRow("select col from table where key='John'"); $arr = $DB->GetAll("select col from table"); $arr = $DB->GetAssoc("select key,col from table"); # returns associative array $key=>col # Retrieve high speed cached recordsets (cached for 3600 secs)And there are more connection examples showing you how to connect to SQLite, Oracle, PostgreSQL, Microsoft SQL Server, MS Access, LDAP, Interbase/Firebird etc.
PHP5 SupportADOdb has full PHP5 support, including SPL and exception support. For example, you can do this in PHP5:
$rs = $DB->Execute("select * from table");If you include the following adodb-exceptions.inc.php file, then ADOdb will throw exceptions when an error occurs:
Requirements: PHP 5.0 or later. There is a version available that works with PHP 4.1 to 5.2 also.
Installation: Unpack files into a directory. Try the above sample code, adjusting the connection parameters to suit your database server, and modify the sql to match your tables.
ADOdb Lite is a separate PHP project done by a 3rd party to cut down the ADOdb library to use a smaller footprint.
Python DownloadsRequires Python 2.3 or later. Works fine with Psyco.
Speed Up Your PHP Code with the ADOdb extensionAdodb-ext-504.zip provides up to 100% speedup by replacing parts of ADOdb with C code. ADOdb will auto-detect if this extension is installed and use it automatically. This extension is compatible with ADOdb 3.32 or later, and PHP 4.3 - 5.x.x. Source code is included. Please note that you will need to compile it yourself. Instructions included.
PHP DocumentationOne HTML Page (this is always the most up-to-date)
Multiple HTML Pages
Windows CHM Format
Other Docs for PHP version
DevShed has some excellent articles by icarus about ADOdb. Latest version of articles at MelonFire:
We have PHP documentation in other languages:
and tutorials in:
For bug reports, feature requests and questions, use the ADOdb Forums. The author monitors this forum.
(c) 2000-2008 John Lim. All Rights Reserved. Contact: jlim#natsoft.com