kmaid Posted January 21, 2009 Share Posted January 21, 2009 Hi all, My current PHP project requires me to cache data for 5 minuets after which IF the data is requested again the data needs to be requested from another server. I store the DateTime when the data was last requested and what I would like to do is make an SQL query which returns true/false depending on if 5 minuets have passed since the stored DateTime. Is this possible and are there any examples of this or should I just convert the DateTime into a php date time and do it in PHP? Thanks Kmaid **EDIT** My bad didnt read sticky mysql version 5.0.51b-community-nt Quote Link to comment Share on other sites More sharing options...
Mchl Posted January 21, 2009 Share Posted January 21, 2009 SELECT IF(NOW() - dateTimeRequested < 300, TRUE, FALSE) FROM table edit it seems that even SELECT NOW() - dateTimeRequested < 300 FROM table will work (and of course 5 minutes is 300 seconds not 600 ) Quote Link to comment Share on other sites More sharing options...
kmaid Posted January 21, 2009 Author Share Posted January 21, 2009 Thanks exactly what i was looking for! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.