Forum Moderators: open

Message Too Old, No Replies

replace html code inside a mysql database

trying to remove <a href=" "> from mysql database

         

drooh

5:08 am on Jul 11, 2007 (gmt 0)

10+ Year Member



I have a MySQL Database that has general information stored in it. Basically there is a field for "website" but the problems is the person who set it up included HTML code inside the fields. Is there a way to purge out the HTML code and just leave the website address starting with [?...]

I am guessing that maybe something like this?

UPDATE directory SET website = '' where website like '<a href="%%">website</a>'

here is what is in the field of the database
<a href="http://www.webmasterworld.com/" target="_blank">www.webmasterworld.com</a>

but I want it to be just this
[webmasterworld.com...]

LBmtb

4:58 am on Jul 12, 2007 (gmt 0)

10+ Year Member



Not sure if there's a good way to do this with mysql alone. Maybe look into a PHP script that

1) gets the data
2) strips it of the tags using strip_tags()
3) updates the record with the stripped data

good luck

drooh

7:00 am on Jul 12, 2007 (gmt 0)

10+ Year Member



thats the one, looks like php can do just about anything! wonder if there is a php code for
cook_dinner($steak)

Habtom

8:16 am on Jul 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>> cook_dinner($steak)

You could run with an error with that ";"

Error: Your food couldn't be done, because there was a hole at line 20 of your dish.

cook_dinner($menu, $time, $size);

lol

LBmtb

8:18 am on Jul 12, 2007 (gmt 0)

10+ Year Member



Wouldn't that be awesome : )