I got a php script where a user will set something to happen at a future date. A unix time stamp is created and stored in mysql. A cron job hits a php script every 15 minutes to see what future dates are coming up and executes them.
Problem is I can't seem to figure out the best way to do this because if I do something like:
SELECT * FROM cron WHERE TIME > UNIX_TIMESTAMP( )
This will show ALL the ones that are in the future, how can I narrow this down more so there isn't much of a gap, like say within a 5 minute time difference. Because the options of future posts are in 15 increments (0,15,45)...so a user can set something that they want to post on 7:45 or 9:15.
SELECT * FROM cron where ((time - UNIX_TIMESTAMP()) < 600) > 0
I would thing the above sql would work but it keeps pulling up results that are negative values and already been executed.
Any ideas?