MYSQL REPLACE string content with field value How can I REPLACE a string value with a other field content?

SELECT REPLACE(html_input,'!value',field_value) FROM table


Value of html_input is &lt;input type='text' value='!value'&gt;

Value of field_value is test

Expected result:

&lt;input type='text' value='test'&gt;
String literals must be enclosed by quotes '.

Quote symbols within a literal must be quoted by slash as \'.

SELECT REPLACE(html_input,'!value',field_value) 
FROM table
/* WHERE html_input = '&lt;input type=\'text\' value=\'!value\'&gt;'
     AND field_value = 'test';
*/