gigantorTRON Posted September 5, 2007 Share Posted September 5, 2007 I'm trying to write a script that will run through a certain column in a database table, strip away all characters up to a '-' and then insert the cleaned rows back into the database. Does anyone have any pointers or help on the best way to do this?? I've selected the entire column into a result set so far... Thanks!! Quote Link to comment https://forums.phpfreaks.com/topic/68065-solved-text-parsing-script/ Share on other sites More sharing options...
trq Posted September 5, 2007 Share Posted September 5, 2007 You should be able to do this within your query. Take a look at the mysql SUBSTR_INDEX function. Something like... UPDATE tbl SET fld = SUBSTR_INDEX(fld,'-',-1); Quote Link to comment https://forums.phpfreaks.com/topic/68065-solved-text-parsing-script/#findComment-342144 Share on other sites More sharing options...
gigantorTRON Posted September 5, 2007 Author Share Posted September 5, 2007 Nice! Thanks Thorpe. I was just looking at that sql function myself... worked like a charm! Quote Link to comment https://forums.phpfreaks.com/topic/68065-solved-text-parsing-script/#findComment-342149 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.