Would this work?

SpaceshipSpaceship
Watch

Barrucadu

Established Member
Impact
64
What this script is supposed to do is delete all articles older than 60 days, would it work?

PHP:
$killdate = date("d-m-Y")-60;
mysql_connect("---Server---","---Username---","---Password---") or die(mysql_error());
mysql_select_db("---Database---") or die(mysql_error());
mysql_query("DELETE FROM `MyPhpArticle` WHERE `date` <= ".$killdate."") or die(mysql_error());
mysql_close();
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
It should work. Just for your information, it will delete any column created 60 days old, irrespective of posts, settings or other data, so when you replace "MyPhpArticle" variable with the table you want to clean up, make sure it has nothing else except post data.
I would recommend that you play with it little bit on dummy databases before actually putting it to any use.
 
0
•••
So it'll delete all entries in the database older than 60 days?
 
0
•••
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Zero Commission
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back