icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » mysql: how can i remove old rows at the table?

PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >>

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old October 19th, 2004, 11:24 PM   #10 (permalink)
Registered User
Seasoned Poster
 
Majd-GFX's Avatar
 
Joined in Sep 2004
58 posts
Gave thanks: 0
Thanked 0 times
i think the easiest thing is to go to www.spoono.com and use a tutorials from there, it works awsome and it's easy
__________________
Majd-GFX is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 20th, 2004, 4:37 AM   #11 (permalink)
Registered User
Comfy Contributor
 
irmtfan's Avatar
 
Joined in Jun 2004
127 posts
Gave thanks: 0
Thanked 0 times
[at] spartas:
how can i put this in a php file? and where upload that file? in root?

[at] Majd-GFX :
could u plz give me the exact url of that document? thanks
__________________
Ready For Romance
first persian harry potter site: www.jadoogaran.org(means wizards.org in english)
ٌWelcome dedi
irmtfan is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 20th, 2004, 11:40 AM   #12 (permalink)
surmunity freak
Comfy Contributor
 
Joined in Sep 2004
Lives in Baton Rouge, LA, North Amewica, USA, Earth
Hosted on D68; Serva; Pass15
143 posts
Gave thanks: 0
Thanked 0 times
Putting it in a PHP file is actually very easy. you would just have the following:

PHP Code:
<?php
define
("user""YOUR_DB_USERNAME");
define("user""YOUR_DB_PASSWORD");
define("host""localhost");
define("db""YOUR_XOOPS_DATABASE");


$cxn mysql_connect(userpasshost);
mysql_select_db(db);

 
$delete_time time() - ( 24 60 60 );  // 7 days/week * 24 hrs/day
// * 60 minutes/hour * 60 seconds/min. 

$sql "DELETE from `xoops_priv_msg` WHERE `read_msg` = '1' AND `msg_time` > '$delete_time'";
//This script would delete everything older than 7 days that has been read.

$result mysql_query($sql$cxn);

?>
That is a very basic script. Just throw that into an empty file, save it with a php extension and upload it. To clear all those old messages, just run the script.
__________________
Server: Pass15
twwright.net
NoE

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050405 Firefox/1.0 (Ubuntu package 1.0.2)

I run ubuntu hoary!
spartas is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 20th, 2004, 3:41 PM   #13 (permalink)
rocks your socks.
Resident.
 
David's Avatar
 
Joined in Mar 2004
Lives in fear of Obama.
Hosted on Pass 7
13,170 posts
Gave thanks: 8
Thanked 35 times
make sure you mark that php file 444 though
__________________
Quote:
Originally Posted by removed View Post
Internet Explorer rules.
David is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 20th, 2004, 4:28 PM   #14 (permalink)
Registered User
Seasoned Poster
 
Majd-GFX's Avatar
 
Joined in Sep 2004
58 posts
Gave thanks: 0
Thanked 0 times
http://www.spoono.com/php/tutorials/tutorial.php?id=5
__________________
Majd-GFX is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 21st, 2004, 6:03 AM   #15 (permalink)
Registered User
Comfy Contributor
 
irmtfan's Avatar
 
Joined in Jun 2004
127 posts
Gave thanks: 0
Thanked 0 times
thank u very much for your excelent support
i correct some typo error in that script and works like a charm.
and the last qestion is how can i choose a part of "pm subject" so every pm has that part delete and others left.

PHP Code:
<?php
define
("user""YOUR_DB_USERNAME");
define("user""YOUR_DB_PASSWORD");
define("host""localhost");
define("db""YOUR_XOOPS_DATABASE");


$cxn mysql_connect(host ,userpass);
mysql_select_db(db);

$delete_time time() - ( 24 60 60 );  // 7 days/week * 24 hrs/day
// * 60 minutes/hour * 60 seconds/min.

$sql "DELETE from `xoops_priv_msgs` WHERE `read_msg` = '1' AND `msg_time` <  '$delete_time'";
//This script would delete everything older than 7 days that has been read.

$result mysql_query($sql$cxn);

?>
__________________
Ready For Romance
first persian harry potter site: www.jadoogaran.org(means wizards.org in english)
ٌWelcome dedi
irmtfan is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On