static function getall($input) {
$where = [];
$params = [];
$sql = 'SELECT * FROM radio_city';
if (isset($input['city']) && $input['city']) {
$where[] = ' city = ?'; // Subsequent additions to $where should specify AND/OR conditional
$params[] = $input['city'];
}
$sql .= implode(' ', $where);
$sql .= " GROUP BY city";
return DB::select($sql, $where, $params);
}
}
Here I am using the Laravel(MVC) framework. I am redirecting input form from controller so how should i concatenate query with that input. So is this code works or need any modification?