For anyone who connects to databases via PHP on a regular basis, use PEAR::DB. It’s absolutely awesome in terms of functionality and ease of use and I guarantee that it will make your day that little bit easier.
PEAR is installed by default by most webhosts. Also, if you want to know how to use it with a real example, check out this article.