1. Go to this page and download the library: Download efoft/query-builder library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
efoft / query-builder example snippets
// select
$q->from('table1, table2 ')->from('table2')->select(array('table2.age'=>'a','table1.name'=>'n'))->where(array('id'=>13));
$q->where(array('age'=>'/3.*/'))->order('name')->limit(100)->distinct();
echo $q->getQuery() . PHP_EOL;
echo print_r($q->getBindings()) . PHP_EOL;
SELECT `table2`.`age` AS a,`table1`.`name` AS n FROM table1,table2 WHERE `id`=:id AND `age` LIKE :age ORDER BY name LIMIT 100;
Array
(
[id] => 13
[age] => 3%
)