开发者

PHP Delete Record after 7 Days?

I want to delete records from a database when they are 7 days or older. I have my server time set to UK time but for some reason the code I wrote below always echo's Account Deleted as 7 or more days old and for some reason it's not working. Before I test on my test database I decided to use a simple echo for now, but as I say it won't work.

Anyone have any suggestions why it's not working? I must be doing something wrong.

<?php

// Get Cu开发者_C百科rrent Time
$current_time = time();

/* The time i used below (unix) for testing is 
18-02-2011 14:34:24 (yesterdays date/time) */
$account_delete = strtotime(time('1298039664'));

if ($current_time - $account_delete >= (7*24*60*60)){
echo 'Account Deleted as 7 or more days old';
} else {
  echo 'Account Not Deleted as less than 7 days old';
}

?>


Replace strtotime(time('1298039664')) with 1298039664?

time() does not take any parameters.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜