Jack Herrington shows us how to fix the common problem. I never used php PEAR DB package, the idea sounds good.
FTA, "Discover five common database problems that occur in PHP applications -- including database schema design, database access, and the business logic code that uses the database -- as well as their solutions.
You can create database design, database access, and the PHP business logic code that sits on top of it in any number of ways, and you often end up getting it wrong. This article illustrates five common problems in database design, in the PHP code that accesses databases, and how to fix these problems when you see them..."
Read more at IBM developerworks...