alconebay Posted September 18, 2009 Share Posted September 18, 2009 $query = "SELECT * FROM schedule WHERE day = '$current_day' AND show_start <= '$current_time' AND show_end > '$current_time' or '00:00:00' ORDER BY show_start ASC LIMIT 1"; I think its the "or" that is messing me up. I'm trying to get it to find the currently running program. That would be the program scheduled for the current day, starts at a time prior or equal to the current time, ends and a time after the current time or at 00:00:00. Quote Link to comment https://forums.phpfreaks.com/topic/174748-solved-cant-get-simple-mysql-query-with-multile-conditions-to-work/ Share on other sites More sharing options...
kickstart Posted September 18, 2009 Share Posted September 18, 2009 Hi Try this:- $query = "SELECT * FROM schedule WHERE day = '$current_day' AND show_start <= '$current_time' AND (show_end > '$current_time' or show_end > '00:00:00') ORDER BY show_start ASC LIMIT 1"; With the or you need to force the order than things are evaluated in . Also you need to specify what you are checking with in the last check (I suspect you might mean show_end = '00:00:00' though). All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/174748-solved-cant-get-simple-mysql-query-with-multile-conditions-to-work/#findComment-920925 Share on other sites More sharing options...
alconebay Posted September 19, 2009 Author Share Posted September 19, 2009 Thanks a lot. ='s 00:00:00 is what I need. I have to add that to represent midnight since computers use 00:00:00 instead of 24:00:00 (I think). I'll give it a try Monday when I'm back at work. Quote Link to comment https://forums.phpfreaks.com/topic/174748-solved-cant-get-simple-mysql-query-with-multile-conditions-to-work/#findComment-921057 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.