This problem is driving me mad!
I have two dates stored in a MySQL table in DATE columns, one named rental_period_begin and the other rental_period_end. The date are stored in the format 0000-00-00. An example date is 0000-01-09 (the year is not required).
The user inputs a date and a duration, causing the generation of two dates:
$start_date = $f_date_month."-".$f_date_day;
$end_date = @strftime("%Y-%m-%d", @mktime(0, 0, 0, $f_date_month, $f_date_day + ($f_duration * 7)));
$end_date = @substr($end_date, 5, @strlen($end_date));
The end date, as you can see, is chopped to remove the "0000-" from the mktime function.
The following SQL in theory (my theory!) should work, and select DB records between the two dates generated above:
WHERE DATE_FORMAT(rental_period_begin, '%m-%d') >= '#".$start_date."#' AND DATE_FORMAT(rental_period_end, '%m-%d') <= '#".$end_date."#'
But it doesn't, and instead no records are found matching the WHERE conditions.
Any help would be great! Thanks,
teknodude