eMonk Posted February 11, 2012 Share Posted February 11, 2012 What am I doing wrong in the following query? $query = "SELECT id, expiry_date FROM pets WHERE expiry_date > CURDATE() AND status = 'Active' "; $result = $db->query($query); It's fetching all rows when it should be none. The CURDATE echo is "2012-02-11" And here's some of my expiry_date data: 2012-02-13 2012-02-14 2012-02-19 What am I doing wrong? I'm just trying to select rows where expiry_date is greater then the current date. Quote Link to comment Share on other sites More sharing options...
eMonk Posted February 11, 2012 Author Share Posted February 11, 2012 I switched the following and it seems to be working correctly now.. WHERE CURDATE() > expiry_date 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.