So it’s probably pretty late in “the game” to be posting this, however I thought I might do it anyway just for those that may want to get started using OOP in PHP. I’ve been using this for a while and improving it wherever I can, then I started using CodeIgniter which ended up having a very similar class built into it. So if you are wanting to learn OOP, this might help you a long and it will make for a good transition into an MVC if you decide to move forward from there.
Keep in mind this has very simple functionality. For the most part, you can execute any style of query you want just by using the first example, however, there are a few extra methods built in that will allow you to easily do inserts and updates.
Call me crazy but I never really got around to adding a delete method in here, mainly because I RARELY delete data from a database, I usually update the row with a “delete date” in some sort of delete column. I can’t imagine adding delete functionality would be very hard. If you decide to use this, tell me what you think!
Select with Where
Please note, my recent updates include adding a new function “seek” and now default to return a mysql_fetch_object() instead of mysql_fetch_array(). This can be easily changed back in the constructor.