I'd agree with Ovid that this is more of a db issue. Since you're using MySQL, you'll probably be interested in O'reilly's "MySQL & mSQL" book. It has a brief section on interacting using DBI, but I think you'll find the areas of most use up in the front of the book, where they talk about proper database design.