Mike Solstice Posted April 14, 2011 Share Posted April 14, 2011 Ok, that works if I run it CLI or though phpMyAdmin, but won't if I try it in php $remcomma = "UPDATE top_train SET deaths = replace( replace(field_name, ',', ''), '"', '' )"; mysql_query($remcomma); I assume because of the quotes used in the regex. I tried escaping the " $remcomma = "UPDATE top_train SET deaths = replace( replace(field_name, ',', ''), '\"', '' )"; mysql_query($remcomma); Which broke it altogether. Anyone have any ideas? Thanks! Moved here since that thread was marked as solved & it's more of a PHP issue at this point anyway. Any & all help is greatly appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/233691-escaping-regex/ Share on other sites More sharing options...
requinix Posted April 14, 2011 Share Posted April 14, 2011 And what are you trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/233691-escaping-regex/#findComment-1201480 Share on other sites More sharing options...
Mike Solstice Posted April 14, 2011 Author Share Posted April 14, 2011 Sorry, kind of assumed people would go read the thread that quote is linked to I have a MySQL column that was created as VARCHAR and has numeric entries that contain commas. I need to convert that to INT in order to be able to use the data in calculations, but need to strip the commas out before I can convert to INT otherwise it just cuts off at the comma & I loose the rest of the data. Quote Link to comment https://forums.phpfreaks.com/topic/233691-escaping-regex/#findComment-1201481 Share on other sites More sharing options...
Mike Solstice Posted April 14, 2011 Author Share Posted April 14, 2011 Nevermind...I found my error. Forgot to specify the field name in the replace command. LOL Thanks anyway!! Quote Link to comment https://forums.phpfreaks.com/topic/233691-escaping-regex/#findComment-1201483 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.