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. Link to comment https://forums.phpfreaks.com/topic/256877-selecting-rows-greater-then-curdate/ 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 Link to comment https://forums.phpfreaks.com/topic/256877-selecting-rows-greater-then-curdate/#findComment-1316924 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.