simple MySQL handler class - Mon Aug 31, 2009
MySQL has come a long way since its early days what with stored query support and such. That said, the usage you will find in the average web application is still going to be limited to basic INSERT, UPDATE and SELECT queries. While there are no shortage of MySQL abstraction classes, all of the ones I have come across tend to either add too much overhead or do not really make the process of retrieving data from the backend any quicker or easier. Thus the creation of this MySQL handler class.
The intent with this class is not to be pretty or completist. It's goal is to provide the core functions needed for the average web application while keeping it simple. Query results are returned as multidimensional array using associative column names. It offers a few "magic" values by default ("insert_id" and "numrows") and has some utility functions thrown in for dealing with the result set.
I do not claim this is the most beautiful MySQL class out there. I can say however that it makes life a lot easier in many situations compared to either dealing with the database directly or using a full scale database abstraction layer.
topics: MySQL, PHP, programming
Experienced PHP web developer.
$35 an hour, no job too small.
There is no replacement for integrity and experience.