Defining all accesses to a MYSQL database on a dynamic page can be painful when you have a lot of information fields to manage. This small class is the beginning for a database layer abstraction (DBAL). Using it, you will never have to make a query again, deal with its syntax, know where to put quotes and not, know what the primary keys of the tables are, etc.... In fact, this information already exists in a database called information_schema. If performance of a site is not the main issue and you want it to make your site maintainable before all, then using this information to simplify the life of the programmer can be the key. But know that these kind of things, and by extension every DBAL, Object Relational Mapper (ORM), like Doctrine for instance, or frameworks like Cake or Zend have huge costs in terms of performance, but will ease your job. It's only a question of choice...
Key select, returns only one row
Field select with limitation
Those 2 functions move the value of the fields object to the post values of the form, when names are identical, and vice versa.
Of course as you can see, to have a real DBAL application, a lot of work needs to be done. These classes however set some principles up. We could complete them with: - Full Select construction functions with COUNT, MAX, MIN functions, - Join capabilities on several tables, - Order, distinct, group by, like clauses, - Inclusion of operators like >, >=, <, <=, NOT, - Inclusion of Boolean operators AND, OR.
2008-09-29: First version