mysql unix_timestamp() w/ interval

admin

Administrator
Staff member
i'm working on a private messaging system
that only allows users to save messages for up to 30 days.

so to clean up the old trash, i plunked down:

-------
$cleanup = "
DELETE FROM $table WHERE p_reader='$p_reader' AND p_date < UNIX_TIMESTAMP() - INTERVAL 30 DAYS;
";
$cleanupnow = mysql_query($cleanup,$conn) or die("cleanuperror");
-------

for sake of simplification, assume $p_reader is "username" or something.

p_date is a 20length int that gets php time() inserted into it (a unix timestamp if i'm not mistaken.


i've changed 30 DAYS to 60 SECONDS, and absolutely nothing happens. does the p_date column need to be a mysql date field type or something?

-a
 
Back
Top