PHP lib CURDATE() issue
PHP lib CURDATE() issue
rpmccormick
Posts: 136Questions: 18Answers: 0
Regarding this Google result (closed thread):
https://datatables.net/forums/discussion/61200/current-date-problem
This is my working SQL:
AND DATE(TimeSpan_Start)=CURDATE()
This solution works:
$Editor->where('DATE(TimeSpan_Start)', date('Y-m-d'), '=');
But I would prefer to use MySQL... why doesn't this work:
$Editor->where('DATE(TimeSpan_Start)', 'CURDATE()', '=', false);
Time-Zones for different Web Servers vs. SQL Server make things complicated.
Replies
It doesn't work like that, because the
Editor->where()
method doesn't have the same signature asQuery->where()
. Specifically there isn't the optional binding parameter. Instead, do:Using an anonymous function like that gives you access to the underlying
Query->where()
method which does allow you to set the binding option.Allan