Possible Duplicate:
why isn't this pulling data from 7 days back?
Here is what I have, it keeps returning all reminders regardless of the date. Can anyone help guide me?
$reminder=$_GET['reminder'];
$date = date('Y-m-d',strtotime("last sunday + INTERVAL 7 DAY "));
$query = ("SELECT * FROM contacts WHERE reminder = '$reminder $date' ORDER BY firstname") or die ('Error: ' .mysql_error());
$result=mysql_query($query);
while ($row = mysql_fetch_array($result)) {
strtotime is amazingly powerful, but it can’t parse a MySQL date selection syntax. If you want 7 days after last sunday, “sunday” works. You can also do, “last sunday + 7 days”.
I don’t know what
$reminderis (are you sure you need to add the date to the reminder variable?), but this will work for your$datevariable:As an aside, this is deadly:
Look up Bobby Tables to understand why that first line should be: