Topshed Posted December 1, 2007 Share Posted December 1, 2007 I am very new to mySQL and I have been trying to find the right syntax for Finding an occurance of a string and replacing it with another, but everything I try in phpmyadmin on my hosting company fails with errors I am wondering if different versions of mySQL have different syntax My Hosting Company is using MySQL 3.23 On my machine I have 5.1 I need to be able to change Multiple errors on the fly either by direct input or with a small php program where I can fill in the blanks This is my latest attempt UPDATE table SET column = REPLACE(`class2`, "Bullied", "Bulleid") WHERE column LIKE "%Bullied%" Can anyone Help please Thanks Roy... Quote Link to comment https://forums.phpfreaks.com/topic/79706-solved-find-replace/ Share on other sites More sharing options...
toplay Posted December 1, 2007 Share Posted December 1, 2007 The value you want to change "from" should be the second argument and the third is what you want to change it to. Also, the search should be looking for the wrong spelled word and not the correct one. So, I would imagine that you meant to have it like this: UPDATE table_name SET column_name = REPLACE(column_name, "Bulleid", "Bullied") WHERE column_name LIKE "%Bulleid%" ; Manual page showing REPLACE(): http://dev.mysql.com/doc/refman/4.1/en/string-functions.html#function_replace Quote Link to comment https://forums.phpfreaks.com/topic/79706-solved-find-replace/#findComment-403729 Share on other sites More sharing options...
Topshed Posted December 2, 2007 Author Share Posted December 2, 2007 Thanks fixed it in One Regards Roy.. Quote Link to comment https://forums.phpfreaks.com/topic/79706-solved-find-replace/#findComment-404040 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.