Please help on how to compare a date with date in database in php
something like
$today = date("y-m-d");
select * from table name where date <= $today
It is not working this way
Please help
Please help on how to compare a date with date in database in php
something like
$today = date("y-m-d");
select * from table name where date <= $today
It is not working this way
Please help
Try this
SELECT * FROM table_name WHERE date <= CURDATE()
You can also use
SELECT NOW(),CURDATE(),CURTIME()
will result in something like this:
NOW() --> 2014-11-22 12:45:34
CURDATE() --> 2014-11-22
CURTIME() --> 12:45:34
For more information go to this link
Add quotes:
$sql = "select * from table name where date <= '{$today}';
And field date
in database set as datetime