Hello,
I am trying to make a script that checks the database for members that expire in the next 60 days, then print their information.
I am not getting any errors but my results are strange. My date range is today (Sept 1 2009) and 60 days from now (Nov 1st 2009). Those 2 variables are set and they print correctly at the top of the results page (see below) but I am getting only 2 dates for expiring members – 1/31/2010 and 10/31/2009.
I know there are members in the DB with Sept and Nov expiration dates but they are not listed.
Code is below along with a sample of my results.
Thanks you for any ideas.
[CODE]<?php
// Set date and time
$today = date(“m/d/Y”);
$sixtydaysout = mktime(0, 0, 0, date(“m”)+2, date(“d”), date(“Y”));
$expiresoon = date(“m/d/Y”, $sixtydaysout);
print “Today is: $today <br/>”;
print “Sixty days from now is: $expiresoon <br/><br/>”;
$result = mysql_query(“SELECT * FROM members WHERE PAID_THRU BETWEEN ‘$today’ AND ‘$expiresoon’ LIMIT 1000″);
$row = mysql_fetch_array($result) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
echo $row[‘FIRST_NAME’]. ” “. $row[‘LAST_NAME’]. “, “. $row[‘PAID_THRU’];
echo “<br/><br/>”;
}
?>
—–RESULTS PAGE—–
Today is: 09/01/2009 – ($today)
Sixty days from now is: 11/01/2009 ($expiresoon)
Tracey Lennemann, 1/31/2010
Patricia Brockhoff, 10/31/2009
Kimberly Melrose – Wyatt, 10/31/2009
Mary-Anne Ross, 10/31/2009
Michele Katila, 1/31/2010
Cheri Lyle, 1/31/2010
Heather Moser, 1/31/2010
Krystina Ash, 10/31/2009
Jill Barber, 1/31/2010
Andrea Salzl, 10/31/2009
Nicaise Moutin, 1/31/2010
Holly Boutin, 1/31/2010
Lisa Gibson, 10/31/2009
Janet Leslie, 10/31/2009
Ann Freimuth, 1/31/2010
Edie Shuman-Gibson, 1/31/2010