Welcome, Guest. Please login or register.
March 21, 2010, 12:06:22 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem Website Baker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite .
110582 Posts in 15968 Topics by 9313 Members
Latest Member: Gudrun
* Home Help Search Login Register
+  WebsiteBaker Community Forum
|-+  English
| |-+  Help & Support (Moderators: Argos, BerndJM)
| | |-+  delete many news at ones
Pages: [1] Go Down Print
Author Topic: delete many news at ones  (Read 170 times)
babsy

Offline Offline

Posts: 299


« on: February 04, 2010, 04:51:42 PM »

HI

i have a client, who has been filling his page with news for the last 3 years, and now the page is getting slow, so i told him to start deleting old news? But it there a fast way of deleting old news (the news are on multiple pages, diff. news)?? anyone knows a fast way!

idea for next WB Smiley make the possibility to delete multible news and multible news post at the same time, maybe it would be good to just select the ones you want to delete and then pres (delete) instead of having to put one by one in the (trash) Smiley

Logged
crnogorac081

Offline Offline

Posts: 1163



« Reply #1 on: February 04, 2010, 05:54:56 PM »

you can connect to DB using phpmyadmin and manualy delete all entries from news table..
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
doc

Offline Offline

Posts: 3581


« Reply #2 on: February 04, 2010, 06:23:08 PM »

Hi,

one comment in addition to the post from crnogorac081.

You could use SQL statements from phpMyAdmin to select (or delete) all news entries older than a certain date.

Simply use something like below in phpMyAdmin to select all news entries older than yyyyyy:
SELECT * FROM `xxx_mod_news_posts` WHERE `posted_when` < 'yyyyyyyyy'

Just replace xxx_ with the prefix of your database if any and yyyyyyy with the timestamp of the first post you want keep. Use PHP date function or this online service to convert Unix timestamp into human readable format. Of course you could also write two lines of code (e.g. in a code section to get the work done).

Doc
Logged
babsy

Offline Offline

Posts: 299


« Reply #3 on: February 04, 2010, 08:41:04 PM »

thank you Smiley i will try that tomorrow!
Logged
babsy

Offline Offline

Posts: 299


« Reply #4 on: February 05, 2010, 03:11:02 PM »

This works fine.. i can delete without a problem Smiley (just have to delete the actual php page also.. through FTP Smiley
Logged
DarkViper

Offline Offline

Posts: 184


« Reply #5 on: February 05, 2010, 04:29:25 PM »

it works as long you have no comments saved for your news.. Then you must delete the corresponding comments also.
You can do it if you execute following 2 SQL-Queries after each other.:

Code:
replace xxxx with your TABLE_PREFIX
>>first execute
DELETE `t1`, `t2` FROM `xxxx_mod_news_posts` AS `t1`
INNER JOIN `xxxx_mod_news_comments` AS `t2`
WHERE `t1`.`post_id` = `t2`.`post_id` AND `t1`.`posted_when` < UNIX_TIMESTAMP( '2005-03-27 03:00:00' )

>>second execute
DELETE FROM `xxxx_mod_news_posts`
WHERE `posted_when` < UNIX_TIMESTAMP( '2005-03-27 03:00:00' )

First query will delete all posts with all attached comments
Second query will delete all other posts without comments.
The order of executing queries is very important!

The SQL-function UNIX_TIMESTAMP makes it easy to insert the timestamp. The format is:  ( 'yyyy-mm-dd hh:mm:ss' )

Logged

1984 was not meant as an instruction manual !!
Pages: [1] Go Up Print 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!