Skip to content

Instantly share code, notes, and snippets.

@jim
Created November 30, 2008 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jim/30490 to your computer and use it in GitHub Desktop.
Save jim/30490 to your computer and use it in GitHub Desktop.
<?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