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........

Recommended Answers

All 5 Replies

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

pleaseeeeeeee

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.

it gives zero results. please guide me....

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";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.