Jump to content

Mysql/Str_Replace


ajicles

Recommended Posts

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&#33; <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&#33; <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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.