Created
November 30, 2008 17:48
-
-
Save jim/30490 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// setup your database connection | |
define('MYSQL_HOST', 'localhost'); | |
define('MYSQL_USERNAME', 'root'); | |
define('MYSQL_PASSWORD', ''); | |
define('MYSQL_DB', 'textpattern'); | |
// connect to the db | |
$link = mysql_connect(MYSQL_HOST, MYSQL_USERNAME, MYSQL_PASSWORD) or die('Could not connect: ' . mysql_error()); | |
mysql_select_db(MYSQL_DB) or die('Could not select database'); | |
// set status to 'hidden' for any articles older than 30 days | |
$query = 'UPDATE textpattern SET Status = 2 WHERE Posted <= DATE_ADD(NOW(), INTERVAL -30 DAY)'; | |
$result = mysql_query($query) or die('Query failed: ' . mysql_error()); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment