SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Replacing values in mysql database

    I am working on cleaning up a database. There is a field where there shouldn't be any html formatting whatsoever, but it does. Is there any possible way to get rid of html tags using the REPLACE function? For example, I would like to delete any <img /> tags and anything within them. Is that possible in SQL?

  2. #2
    SitePoint Addict
    Join Date
    Apr 2006
    Posts
    249
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Possibly - but I usually just create a perl or php script to do this kind of thing, especially as you can always run it again later if needed or modify it for other administrative tasks, set it up on a cron job, etc.

  3. #3
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    specifically to remove <img /> tags and paired tags? not easily. you could do simple tags like <br />.

    i agree with adwatson: this is better accomplished by a simple PHP or Perl script.
    Check out our new Industry News forum!
    Keep up-to-date with the latest SP news in the Community Crier

    I edit the SitePoint Podcast

  4. #4
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah. I'll just use RegEx to clean up within my scripts. I just didn't want to have to use up the extra memory needed to run regex on each record on outout. Thanks!!


Tags for this Thread

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
  •