lordshoa Posted July 6, 2011 Share Posted July 6, 2011 Having trouble replacing text in a field, mysql does it stuff but does not change the text but says successful ? SELECT Replace( `fulldescr`,'This overview section','The description section') FROM `details` WHERE `id` = '14514' LIMIT 1 Any help would be great Thanks Quote Link to comment https://forums.phpfreaks.com/topic/241223-mysql-replace-does-not-replace-text-help/ Share on other sites More sharing options...
Pikachu2000 Posted July 6, 2011 Share Posted July 6, 2011 What are you trying to do with that? It won't change the data that exists in the table, as it's a SELECT query. Quote Link to comment https://forums.phpfreaks.com/topic/241223-mysql-replace-does-not-replace-text-help/#findComment-1239088 Share on other sites More sharing options...
lordshoa Posted July 6, 2011 Author Share Posted July 6, 2011 I am trying to replace the text with diffarent text, but there is more text in the row field that I want to keep as each row is diffarent. I used code below to change text in a field before and worked perfectly well with SELECT SELECT Replace(image_path , '..', '.') FROM `images` Quote Link to comment https://forums.phpfreaks.com/topic/241223-mysql-replace-does-not-replace-text-help/#findComment-1239092 Share on other sites More sharing options...
Pikachu2000 Posted July 6, 2011 Share Posted July 6, 2011 A SELECT query doesn't change anything in the table. It would be used if you want to display the data differently than the way it's stored. If you want to actually change the data in the table, you would need to run an UPDATE query. Quote Link to comment https://forums.phpfreaks.com/topic/241223-mysql-replace-does-not-replace-text-help/#findComment-1239095 Share on other sites More sharing options...
lordshoa Posted July 6, 2011 Author Share Posted July 6, 2011 thanks Do not know why I had the wrong query as my working example for myself. UPDATE `details` SET fulldescr = replace(`fulldescr`, 'This overview section', 'The product description section') WHERE `id`='14514' LIMIT 1 Quote Link to comment https://forums.phpfreaks.com/topic/241223-mysql-replace-does-not-replace-text-help/#findComment-1239100 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.