Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 02:21 pm EST

Geeklog Forums

ooops i edited my sql database now i need to clean it up


baddrink

Anonymous

I got hit with a comment spammer and i dropped down into SQL and deleted a whole bunch of them the only problem is now that the stories table still has the comments = 1 in all of the stories , i can pull all of the affected records with

SELECT * FROM `gl_stories` WHERE `comments` ='1'


but what is the command to change those records to 0 ?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Hint: You may want to use the Spam-X MassDelete Comments module next time. It also fixes the comment count in the stories.

Quote by: baddrink

i can pull all of the affected records with

SELECT * FROM `gl_stories` WHERE `comments` ='1'

but what is the command to change those records to 0 ?


If that's really what you want to do, then that would be
Text Formatted Code
UPDATE gl_stories SET comments = 0 WHERE comments = 1

Note that this won't check if there are any comments for a story. So if you have stories that still have 1 valid comment, those would also be reset to 0.

The proper solution to handle that case as well would require some PHP code ...

bye, Dirk
 Quote

baddrink

Anonymous
Thanks that fixed it, i had to do a few manual changes but that got most of them fixed. And yeah i should have used the spamx util but i didnt think about it until after i had done a mass delete via sql
 Quote

All times are EST. The time is now 02:21 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content