I'have a problem in my Sql query in PHP:
If I do :
$result = mssql_query("SELECT xx FROM x JOIN x ON x WHERE x = '".$var1."'
AND x BETWEEN '20150401 00:00:00' AND '20150401 23:59:59' ")
That's work
But if I do :
$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 FROM x JOIN x ON x WHERE x = '".$var1."'
AND x BETWEEN '".$dateStart."' AND '".$dateEnd."' ")
That's doesn't work !
I don't understand why
Do you have any idea ?
Thanks
echo $dateStartandecho $dateEndbefore calling your query to see if the values you're entering are correct.