affordit Posted March 14, 2008 Share Posted March 14, 2008 Can someone tell me whats wrong with this line? The and portion does not seem to be working. $query = "select * from test WHERE end_date <= '". date('Y-m-d', strtotime('+ 5 days')) ."' AND remind_date = '0'"; Link to comment https://forums.phpfreaks.com/topic/96168-syntax-question/ Share on other sites More sharing options...
soycharliente Posted March 14, 2008 Share Posted March 14, 2008 Echo the query to see what it's actually trying to run. Link to comment https://forums.phpfreaks.com/topic/96168-syntax-question/#findComment-492261 Share on other sites More sharing options...
affordit Posted March 14, 2008 Author Share Posted March 14, 2008 select * from test WHERE end_date <= '2008-03-19' AND remind_date = '0' Link to comment https://forums.phpfreaks.com/topic/96168-syntax-question/#findComment-492264 Share on other sites More sharing options...
soycharliente Posted March 14, 2008 Share Posted March 14, 2008 That looks perfect to me. MySQL manual confirms the syntax for date comparison. I have no idea man. Try? <?php $end_date = date("Y-m-d", strtotime("+ 5 days")); $remind_date = 0; $query = "SELECT * FROM `test` WHERE `end_date` <= '$end_date' AND `remind_date` = '$remind_date'"; ?> Link to comment https://forums.phpfreaks.com/topic/96168-syntax-question/#findComment-492270 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.