Search Help Board

PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help

C# Help

?timestamp-select where rows is older than 7 days
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));

$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) ){





Go to Top??|??Go to Topic??|??Threaded View??|??Search?
New Topic
?Reply To This Message
?Your Name:
?Your Email:
Email replies to this thread, to the address above.

Provided By