Posts: 41
Threads: 8
Joined: Oct 2015
Reputation:
0
Good evening, I want to do a system automatically delete the inactive house after a month?
That is, the houses buy after a while and those players do not enter the server..
can someone help me please nice?
Posts: 716
Threads: 92
Joined: May 2018
Well if you're using MySQL you can do something like...
Код:
DELETE FROM houses WHERE houseid < (CURDATE() - INTERVAL 30 DAYS);
Or..
Код:
CREATE EVENT delete_event
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 30 DAYS
ON COMPLETION PRESERVE
DO BEGIN
DELETE houses WHERE houseid < DATE_SUB(NOW(), INTERVAL 30 DAYS);
END;
Or you can set a cronjob in your cPanel each 30 days, then link it to a .php file:
pawn Код:
<?php
include 'your_db_connection';
mysql_query("DELETE FROM houses WHERE houseid < NOW()");
?>
Posts: 41
Threads: 8
Joined: Oct 2015
Reputation:
0
do not use mysql, It's on .ini files
Posts: 716
Threads: 92
Joined: May 2018
Then i don't know. I suggest you to use mysql for this things. it's more fast and efficient.