Lukas Smith has an example of how to use his MDB2 package in one of his latest blog posts.
I just wanted to show case some of the new features in MDB2. I especially wanted to demo some PHP5 specific features. The following example just creates a table with an autoincrementing primary key column 'id', inserts some values, fetches the last inserted id and finally, after selecting those values and outputs them using an iterator, drops the table again...
The example should work with MySQL and PostgreSQL, but not with SQLite (due to a limitation in the SQLite API). The MDB2 library makes interfacing with the database nice and clean, using functions like prepare(), execute() and query() to do the hard work for you.