Announcement

Collapse
No announcement yet.

Changing HTML in Posts in the Database via SQL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Changing HTML in Posts in the Database via SQL

    I've had a service provider I use for html slideshows change their parameter format, so all my hundreds of manually embedded slideshows have stopped working.

    It's over 20hrs of work to manually fix everything, but I'm thinking there should be a way to find an replace strings directly in the database, right? Could an sql query be created that can just 'find and replace' everything I need?

    Any assistance appreciated. Feel free to ask whatever questions necessary to get the details you need to help me.
    Huntsville's Premiere Car and Bike e-magazine: www.huntsvillecarscene.com

  • #2
    I've run across the SQL Replace function in my research:
    http://www.1keydata.com/sql/sql-replace.html

    Has anyone tried using this to change post information?
    Huntsville's Premiere Car and Bike e-magazine: www.huntsvillecarscene.com

    Comment


    • #3
      This is the query you need to use:

      UPDATE post SET pagetext = REPLACE(pagetext, 'old name', 'new name')

      Always backup before running a query just in case.

      Comment


      • #4
        Thank you! I'll be backing up and turning off my site before trying anything.

        What exactly does each piece of that query do? So that I better understand what I'm doing.
        Huntsville's Premiere Car and Bike e-magazine: www.huntsvillecarscene.com

        Comment


        • #5
          Originally posted by Samir View Post
          Thank you! I'll be backing up and turning off my site before trying anything.

          What exactly does each piece of that query do? So that I better understand what I'm doing.
          Could you post the parameter format that you currently have and the one you want to use.

          Comment


          • #6
            I'm not sure I'm following you on 'parameter format that you currently have'. Beside your query, I don't really have one yet. I don't even know exactly which tables the posts are contained in.

            I was going to use phpmyadmin to look around in the database and figure out where the data I want to change resides and then keep experimenting with queries until I got the result I wanted. Then I was going to restore the db and try it for real.
            Huntsville's Premiere Car and Bike e-magazine: www.huntsvillecarscene.com

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...
            X