Jump to content

Selecting rows greater then CURDATE()


eMonk

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.