I need result which shows all the dates which expire after or within 90 days form now on(current date) but this query also shows results which already expire like it shows 27 sep 2009 which is before current date. I need only those which are expiring from today and with in 3 months means in October, November, and December.
and when November comes i need alerts for all which are expiring in Nov,Dec, and Jan.

$r=mysql_query("SELECT * FROM lease_south WHERE current_date() >= (LAPeriodEnd - INTERVAL 90 DAY) ");

Thanks in Advance........

7 Years
Discussion Span
Last Post by ayesha789

please tell me. i need alerts today for those which will be expire within 3 upcoming months. please guide me. thanks.


You need to add an 'AND' clause to your where statement..

$r=mysql_query("SELECT * FROM lease_south WHERE current_date() >= (LAPeriodEnd - INTERVAL 90 DAY) AND current_date()  < LAPeriodEnd");

hope this helps.


I use this query and now problem is solved. thanks

$r=mysql_query("SELECT * FROM lease_north WHERE (current_date() >= (LAPeriodEnd - INTERVAL 90 DAY)) AND (current_date() <= (LAPeriodEnd - INTERVAL 0 DAY)) ");
$num_rows = mysql_num_rows($r);
echo "$num_rows\n";
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.