SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Find and replace <strong> tags

    Hi guys,

    I recently upgraded a script I have using the automated php wizard, however something crazy has happened and in the title fields the titles of my pages are now enclosed with
    Code HTML4Strict:
    <strong>title</strong>
    tags.

    There's over 5000 pages so as you can imagine changing this all by hand is going to be a nightmare.

    I'm not well versed in mysql, I know how to run sql dumps and that's about as far as I go.

    Can someone help me with the syntax to get rid of these tags?

    The table is: content
    The field is: title

    Many thanks for any help!

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try:

    Code sql:
    UPDATE content SET title = REPLACE(REPLACE(title, '<strong>', ''), '</strong>', '');

  3. #3
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're a star SJH, thank you so much!
    That's saved me weeks of work in 5 seconds!

    I've just noticed I have a few more textual glitches (what a pain)!
    I've tried to adjust the demo syntax to suit but I'm getting errors.

    Code MySQL:
    UPDATE content SET title = REPLACE(REPLACE(title, '’s', ''s');

    I have these symbols appearing in my title ’s (instead of an apostrophe, s)

    For example: John’s should be John's.

    Do you know why the above syntax doesn't work?

  4. #4
    SitePoint Addict
    Join Date
    Jun 2005
    Posts
    269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah managed to solve it by entering:

    \'s instead of 's many thanks again.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •