replace esiting data?
What i need to do is take some existing data and replce it in mysql with new data. Basicly take html tags out of a field and in the case of <BR> replace that with \n
the only thing is i don't know how to do this with a single query to the database. I know i can use PHP and put it in a loop but i thought it would be better to just run a single sql statement to do the job for me.
is it possable? i found REPLACE in the mysql manual is that something i need to use? it don't look like it to me though. If somebody could help me out with this it would be great!
if you have html tags in the data stored in mysql, it will not be possible to strip them all out easily
you could use multiple iterations of the REPLACE function, but this will only replace exact matching strings
e.g. you can say REPLACE(htmlcolumn,'<p>','') but that will not handle tags like <p id="foo">
unfortunately, mysql's REGEXP only matches, it doesn't replace
Hey rudy thanks for the reply, I ended up writing a php script to do it for me. Just threw in a while loop and parse 150,000 records and everything went fine.
Thanks for the reply!