MySQL: remove special character from DB field

UPDATE table_name SET `field_name` = REPLACE(`field_name`, ‘<‘, ”);
UPDATE table_name SET `field_name` = REPLACE(`field_name`, ‘>’, ”);
UPDATE table_name SET `field_name` = REPLACE(`field_name`, ‘”‘, ”);
UPDATE table_name SET `field_name` = REPLACE(`field_name`, ‘%’, ”);
UPDATE table_name SET `field_name` = REPLACE(`field_name`, ‘;’, ”);
UPDATE table_name SET `field_name` = REPLACE(`field_name`, ‘(‘, ”);
UPDATE table_name SET `field_name` = REPLACE(`field_name`, ‘)’, ”);
UPDATE table_name SET `field_name` = REPLACE(`field_name`, ‘\\’, ”);
UPDATE table_name SET `field_name` = REPLACE(`field_name`, ‘\”, ”);
UPDATE table_name SET `field_name` = REPLACE(`field_name`, ‘&’, ‘AND’);




If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a comment

Your email address will not be published. Required fields are marked *