I have a large mysql database with more than 8.000.000 products
At this moment The column 'productname' can contain values for example 'Tag_Heuer Watch "pilot" (red)'
I have millions of rows with non A-Z and 0-9 characters in the productname field
I want to remove all the strange characters in this field and just leave a-z and 0-9 and spaeces. So in this example i want this field to be 'Tag_Heuer Watch pilot red'.
Offcourse i can loop through all rows en str_replace the fields with the following function:
<?php
function stripJunk($string){
$string = preg_replace("/[^a-zA-Z0-9]/", " ", $string);
$string = preg_replace("/\s{2,}/"," ",$string);
$string = trim($string);
return $string;
}
?>
But this take hours :-(
What is the best fastest way to do this in probably 1 query?