$data = [
'fields' => '*',
'table' => 'user',
'alias' => 'User',
'joins' => '',
'conditions' => ' WHERE email = \'wordpress\' AND password = \'b1909932aac1c5510c044de0cb8c0f3ef049a250\'',
'group' => '',
'order' => '',
'limit' => '',
];
// $abc = 'SELECT * FROM user User WHERE email = \'wordpress\' AND password = \'b1909932aac1c5510c044de0cb8c0f3ef049a250\' '
function renderStatement($type, $data) {
extract($data);
$aliases = null;
switch (strtolower($type)) {
case 'select':
// SELECT u.`email`, m.title FROM `user` as u JOIN movie_category as m WHERE u.id =1 LIMIT 1
return "SELECT {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$group} {$order} {$limit}";
break;
}
};
$data = [
'table' => 'user',
'alias' => 'User',
'joins' => '',
'fields' => '*',
'conditions' => ' WHERE email = \'wordpress\' AND password = \'b1909932aac1c5510c044de0cb8c0f3ef049a250\'',
'group' => '',
'order' => '',
'limit' => '',
];
$abc = renderStatement('select', $data);
// $abc = 'SELECT * FROM user User WHERE email = \'wordpress\' AND password = \'b1909932aac1c5510c044de0cb8c0f3ef049a250\' '