View Single Post
Old 11-18-2011, 09:30 PM  
eMonk
Confirmed User
 
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
:stop MYSQL Help Needed with CURDATE()

I'm trying to only fetch the rows where the expiry_date column is 3 days before today's date.

Code:
<?php

include("../includes/connect.php");

$query = "SELECT expiry_date FROM model WHERE expiry_date BETWEEN CURDATE() AND CURDATE() - INTERVAL 3 DAY";
$result = $db->query($query);

$num_results = $result->num_rows;

echo "$num_results";

?>
$num_results should echo "1" because there is 1 expiry_date column with "2011-11-17" but it's echoing "0". Any ideas?
eMonk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote