How to Delete Old post from the database

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 01-16-2007, 09:24 AM
New Pligger
 
Join Date: Jan 2007
Posts: 25
I want to delete the old posts from the database, is there any inside the pligg to do it. I want to utilize my database space to the maximum
Reply With Quote
  #2 (permalink)  
Old 01-16-2007, 09:42 AM
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,215
http://www.pligg.com/wiki/index.php?...stories_script

Something I put together a long time ago.
Reply With Quote
  #3 (permalink)  
Old 01-16-2007, 09:58 AM
New Pligger
 
Join Date: Jan 2007
Posts: 25
Thanks Can you please throw more light on this code, You mean i have to save this in a separate file or i have to incorporate this below code.
And more im little bit confused on the numbers 1209600 and 7776000 plz explain thanks once again.
<?php

mysql_connect("dbhost", "dbname", "dbpass") or die("error1");
mysql_select_db("dbname") or die("error2");

$fourteen_days = 1209600;
$now = date("U") - $fourteen_days;
$ninety_days = 7776000;
$now2 = date("U") - $ninety_days;

$now = date("Y-m-d H:i:s",$now);
$now2 = date("Y-m-d H:i:s",$now2);

mysql_query("delete from links where link_date < '$now' AND link_status = 'queued'");
mysql_query("delete from links where link_date < '$now2' AND link_status = 'published'");
mysql_query("delete from links where link_status = 'discard'");

?>
Reply With Quote
  #4 (permalink)  
Old 01-16-2007, 10:15 AM
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,215
Those numbers are what 14 and 90 days are in seconds.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete users from database and admin user management bbrian017 Questions and Comments 18 02-22-2011 12:51 AM
Warning: Error establishing mySQL database connection. - Errors on all pages - HELP! comptalk Questions and Comments 3 04-21-2009 12:44 PM
Delete old story's (not discard) but out of database etc. Fred007 Questions and Comments 5 01-28-2009 08:46 AM
how to delete links from database? ivytony Questions and Comments 1 02-16-2008 01:15 AM
As a "god" user, can I delete a post? jmruas Questions and Comments 9 09-27-2007 07:38 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development