Author:??(---.dsl.telesp.net.br)
Date:???06-05-03 17:21
After much pull of hair... here is where i got, maybe someone has a better idea..., how to delete rows older than 7 days from table.(not really 7 days, dont know why!...)
First i got the mkdir to find the date of seven days before now, then i query the table with rows where timestamp is less than this.
take a look,
---------------------------------------------
$m8days = date("YmdHis",mktime(0,0,0,date("m"),-7,2003));
//$total=intval($timestamp-$birthday);
$connection = mysql_connect("$hostname", "$username", "$password") or die ("no connection.");
$db = mysql_select_db("$database", $connection) or die ("nao pode selecionar db...!");
//$query = "DELETE FROM classifieds WHERE timestamp < 'm8days'";
$query ="SELECT * FROM classifieds WHERE timestamp < '$m8days' ";// WHERE timestamp <$m8dias'
$result = mysql_query($query) or die("query error");
$num_rows = mysql_num_rows($result);
while ($row = mysql_fetch_array ($result) ){
echo"$row[name] $row[timestamp]
";
}
-----------------------------------------
Ivan
|
|