Originally posted by nephicheng
your sql logic is off.
Well, that's incredibly helpful, isn't it?
Ok, let's sort out the date stuff first and then fix the query...
I'll assume you understand that [man]date()[/man] will produce a formatted representation of a 'seconds since the epoch' UNIX timestamp. If not, check the link and/or just ask.
[man]strtotime()[/man] creates a timestamp based on a given string.
So, the form returns the value '3' meaning three days... to determine the timestamp:
[$form_value=$_POST['value']; // example: 3
$exp_string=$form_value." days ago";
$exp_time=strtotime($exp_string); // this now represents the timestamp from three days ago
Now we can build the query...
$query="DELETE FROM event WHERE type='news' AND rdate<$exp_time";
$r=mysql_query($query);
This assumes that you have filled rdate with UNIX timestamps using [man]time()[/man].