MySQL select between dates leaving blank -
i'm trying search.
and there input startdate , 1 finaldate.
but person might not type start or final date or neither...
im trying use:
(data between ".$startdate." , ".$finaldate.")
leaving blank it's not working, unless put start , final dates.
i wanted if person doesn't type dates, keeps searching rest.
is possible?
==edited per request==
put before sql query:
if(empty($finaldate)) $where = "(data >= ".$startdate.")"; else if(empty($startdate)) $where = "(data <= ".$finaltdate.")"; else $where = "(data between ".$startdate." , ".$finaldate.")";
and change
(data between ".$startdate." , ".$finaldate.")
with
".$where."
Comments
Post a Comment