AceDAO is a query helper for PHP, released under the new BSD license (code and documentation).
CAUTION: This package is still not documented and in early development state...
AceDAO provide some reusable system to query databases and is build on top of PDO.
// i want the red cars, with buyer information, sold in the past two month, ordered by price (bigger first) $config = array( 'from' => 'car c', 'join' => array( 'buyer b' => array( 'select' => array('name') ) ), 'where' => array( 'color' => 'red', 'selldate' => array( 'operator' => '>=', 'value' => '2013-09-01' ) ), 'orderby' => array( 'price' => 'desc' ) ); $results = \Acedao\Database::getInstance()->select($config);
The results will be automatically formatted according to the database implicit schema. You want the cars with the buyer information, you'll get something like this:
<pre>Array (  => Array ( [id] => 100 [brand] => Ferrari [model] => F40 [price] => 300000 [color] => red [buyer] => Array ( [id] => 12 [name] => Luke Skywalker ) )  => Array ( [id] => 13 [brand] => Lamborghini [model] => Murceliago [price] => 250000 [color] => red [buyer] => Array ( [id] => 22 [name] => Anakin Skywalker ) ) ) </pre>
Read documentation on the different steps to party with it.
All is here :)