In my database I have a column called featured it is of type datetime and the default value is current-timestamp
Now i want to find all rows where the featured date is greater than now, should be simple enough using this
$sql = "SELECT id FROM `directory` WHERE category LIKE '%$cat%' AND LOWER(`town`)=LOWER('$city') AND `featured` > NOW() ORDER BY dateadded DESC";
But if I make a new entry in the db, those new entries are returned by above sql even though those would have featured date a few seconds before "now".
So I tried
$sql = "SELECT id FROM `directory` WHERE category LIKE '%$cat%' AND LOWER(`town`)=LOWER('$city') AND `featured` > NOW() + INTERVAL 6 HOUR ORDER BY dateadded DESC";
This worked, but now it doesnt work, i increased it to 48 hours and now it works again
but really
`featured` > NOW()
Should be enough because when i use this sql all values in the db would be in the past even if just by a few seconds, so why is this