2
I have this code:
if(isset($params['bedrooms']) && is_numeric($params['bedrooms']) && $params['bedrooms'] > 0){
$what['bedrooms >= ?'] = $params['bedrooms'];
$what_or['suites >= ?'] = $params['bedrooms'];
}
$where = implode(' AND ',array_keys($what));
$conditions = array_values($what);
if (!empty($what_or)) {
$where .= ' OR ' . implode(' OR ', array_keys($what_or));
$conditions = array_merge($conditions, array_values($what_or));
}
pr($where);
die();
That will result me in:
modality_id = ? AND property_type_id = ? AND properties.city_id = ? AND status = ? AND bedrooms >= ? OR suites >= ?
But I must return this with bedrooms >= ? OR suites >= ?
between parentheses, how can I do this?
Ps: not to be used str_replace().
Thank you for the reply! So I got this as a result :
modality_id = ? AND property_type_id = ? AND properties.city_id = ? AND status = ? AND garage >= ? AND bedrooms >= ? OR (suites >= ?)
when I need it to work like thismodality_id = ? AND property_type_id = ? AND properties.city_id = ? AND status = ? AND garage >= ? AND (bedrooms >= ? OR suites >= ?)

– GWER
I updated my reply @GWER, see if you solved it.
– bfavaretto
It worked! Thank you very much!
– GWER