ajicles Posted August 8, 2010 Share Posted August 8, 2010 I have a row in my sql I had to remove quotes from a href links to import it into my database because it was a csv file and delimiters were quote so I made a script to remove them. But I made a script to remove them: $file = file_get_contents('ibf_forums.csv'); $file = str_replace('="','=^69^',$file); $file = str_replace('\"','\^69^',$file); $file = str_replace('"\ ','\^69^',$file); Now I need to put them back in. So I need to replace ^69^ in a database. If I use UPDATE it will over write it all without replace just a part of it. An example if I don't make sense: Thanks! <img src=\^69^http://domain.com/style_emoticons/<#EMO_DIR#>/tongue.gif\^69^ style=\^69^vertical-align:middle\^69^ emoid=\^69^\^69^ border=\^69^0\^69^ alt=\^69^tongue.gif\^69^ /> Into this: Thanks! <img src=\"http://domain.com/style_emoticons/<#EMO_DIR#>/tongue.gif\" style=\"vertical-align:middle\" emoid=\"\" border=\"0\" alt=\"tongue.gif\" /> Link to comment https://forums.phpfreaks.com/topic/210170-mysqlstr_replace/ Share on other sites More sharing options...
JonnoTheDev Posted August 9, 2010 Share Posted August 9, 2010 UPDATE tablename SET fieldname = REPLACE(fieldname,"\^69^",'"'); Link to comment https://forums.phpfreaks.com/topic/210170-mysqlstr_replace/#findComment-1096972 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.