I'm trying to get a date that's 60 days in the past and bring it up in a while statement and send a SQL function to delete anything over 60 days in my database, however, when I echo the date, all I get it 1969-12-31
Here is the code:
<?php
include("db_connect.php");
$result = @mysql_query("SELECT date_rec FROM orders WHERE rec = '1'");
while($days = mysql_fetch_array($result)){
$today = date( "Y-m-d", time() );
$yesterday = mktime (0,0,0,date("Y") ,date("m")-2,date("d"));
$before = date("Y-m-d",$yesterday);
if ($days['date_rec'] >= $before){
echo"<br>$before";
$result1 = @mysql_query("DELETE * FROM orders");
}
echo("
<body bgcolor='#00004a'><center><font color=#cccccc size=1 face=arial>$before<br>
All received items have been deleted from the database.
");
}
//<META HTTP-EQUIV=\"Refresh\" CONTENT=\"5; URL=churchs_options.htm\">
?>