Forum Moderators: coopster
On successful running of the script I remember the date in db
CREATE TABLE log(id INT NOT NULL auto_increment, ttime DATETIME, other_info TEXT, PRIMARY KEY(id));
The sql query that I use now is:
SELECT HOUR(CURDATE() - ttime) as h FROM log ORDER BY h LIMIT 1;
However I have a problem - it returns sometimes value NULL (which is always first).
If I use the following syntax:
SELECT HOUR(CURDATE() - ttime) as h FROM log WHERE h IS NOT NULL ORDER BY h LIMIT 1;
What can I do?