mysql - SQL Query in PHP date -


i'have problem in sql query in php:

if :

$result = mssql_query("select xx x join x on x x = '".$var1."'  , x between '20150401 00:00:00' , '20150401 23:59:59' ") 

that's work

but if :

$day=date("d/m/y",time()); $explodate = explode("/", $day); $datestart = $explodate[2].$explodate[1].$explodate[0]." 00:00:00"; $dateend = $explodate[2].$explodate[1].$explodate[0]." 23:59:59"; $result = mssql_query("select xx x join x on x x = '".$var1."'  , x between '".$datestart."' , '".$dateend."' ") 

that's doesn't work !

i don't understand why
have idea ?

thanks

kiss principle.

date('y-m-d 00:00:00')."' , '". date('y-m-d 23:59:59') 

or

$today = date('y-m-d'); // ... ... "between '" . $today . " 00:00:00' , '" . $today . " 23:59:59'" 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -