ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

SQL query to delete all closed comments

May 22, 2012 4:59pm

Subscribe [2]
  • #1 / May 22, 2012 4:59pm

    songdogtech

    10 posts

    Hello, I’ve started working on an EE1.6.4 site that has 150,000 closed comments (spam) in “Comments Awaiting Validation” in the CP home.

    I’m familiar with phpmyadmin from other CMSs. Is there an SQL query I can run to delete all those closed spam comments?

    There may be a few “good” comments that are closed, but they will be too old to be useful anyway.

    Thanks, Mark

  • #2 / May 23, 2012 9:33pm

    ChiefAlchemist

    913 posts

    Off the top of my head I’m a bit rusty on EE 1.x. But if you look under Admin and then Utilities (?) you can do your SQL from within the EE CP. There’s also a link to show the tables and from there the fields. You probably don’t need phpMyAdmin.

    And to answer your question, yes there is a SQL statement. I just don’t know it off the top of my head :(

  • #3 / May 23, 2012 9:59pm

    songdogtech

    10 posts

    Thanks, I found some help at Stack Overflow. Run

    DELETE FROM exp_comments WHERE status = ‘c’

    in phpmyadmin or within admin where you can run queries. That will delete all closed comments. Backup the DB before you run it.

     

  • #4 / May 23, 2012 10:16pm

    ChiefAlchemist

    913 posts

    How about starting with

    SELECT * FROM exp_comments WHERE status = ā€˜c’?

    or

    SELECT * FROM exp_comments WHERE status = ā€˜c’ AND entry_id > #?

    Most of the times I’ve done mass deletes they are after a certain row. If you add that to your where you’re less likely to break something 😊

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases