View Single Post
  #1 (permalink)  
Old 07-15-2008, 10:41 AM
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 249
finding and replacing strings in database

I'm trying to find which function fits the script. My objective is to find all the records where there are   including the misspellings (nbsp;, nbsp, &nbsp) and replace them with the space bar " ":
PHP Code:
$sql "SELECT * FROM ".$acronym."_pages WHERE content LIKE '%nbsp%'";
$result mysql_query($sql) OR exit( 'Error: ' mysql_error() );
    
//echo $sql;
    
function nbspSearch(){
        
//insert code here
    
}
    while(
$row mysql_fetch_array($result)){
        
sql2 "UPDATE ".$acronym."_pages SET content = '".str_replace(nbspSearch(), " "$row['content'])."' WHERE content = '".$row['content']."'";
    }
mysql_close($con); 
If anyone has a better suggestion than mine let me know. Thanks.
Reply With Quote