I have a problem with my select : I have a form with 2 text boxes : date_min and date_max. This dates come in controller :
2015-05-15
Now in database my dates : c_win like this :
2015-08-20 21:20:20
In the query I do :
if ($date_min != '' && $date_max != ''){
$aFilter = ' AND c_win > '.$date_min.' AND c_ig.date_gain < '.$date_max;
}
But I think I need to reface the dates. Help me please!! Thx in advance
You need quotes around your dates
$aFilter = ' AND c_win > "'.$date_min.'" AND c_ig.date_gain < "'.$date_max.'"';