Skip to Content (c) Skip to Navigation (n) Skip to Search (s)

1.0-beta (rev 290) released!

xPDO is in beta and we're changing focus to improve documentation and usability. xPDO is being used to develop MODx Revolution 2.0, a next generation PHP-based, Open-Source content management framework.

Forgotten credits...

I'd like to extend a special thanks to Andrea Giammarchi for his PDO for PHP 4 implementation that inspired me to begin coding this project. If not for PHPClasses.org and the inspiration I found in Andrea's work there, the OpenExpedio project would likely not exist, as I probably would have invested my time in working with PHPDoctrine.

Making the connection

To use these classes, we first need to make a connection to the database by including and getting an instance of the xPDO class, using a string DSN representation of the database connection. For mysql, this initial code would look something like this...

include_once (strtr(realpath(dirname(__FILE__)), '\\', '/') . 'xpdo/xpdo.class.php');
$xpdo= new xPDO('mysql:host=localhost;dbname=mydb', "mydbuser", "mydbpass");

If there is a problem connecting to the database, PDO will throw an Exception in PHP 5, or an Error in PHP 4. See the PDO documentation for more information on connecting with PDO.