View Single Post
  #1 (permalink)  
Old 07-16-2008, 12:40 AM
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 249
preg_replace causing to repeat

I think the preg_replace is causing the former result to repeat:
Quote:
INSERT INTO correction_nbsp (bwas_pages_id, content_before, content_after) VALUES (702, 'chapter: ', ' CHAPTER 1 chapter: ')
INSERT INTO correction_nbsp (bwas_pages_id, content_before, content_after) VALUES (711, 'copies &nbspfrom &nbspauthoritative &nbspsources &nbspshowing &nbspthe ', ' CHAPTER 1 chapter: copies from authoritative sources showing the ')
INSERT INTO correction_nbsp (bwas_pages_id, content_before, content_after) VALUES (714, 'told what the truth is, and still not see it. ', ' CHAPTER 1 chapter: copies from authoritative sources showing the told what the truth is, and still not see it. ')
INSERT INTO correction_nbsp (bwas_pages_id, content_before, content_after) VALUES (716, 'see it? ', ' CHAPTER 1 chapter: copies from authoritative sources showing the told what the truth is, and still not see it. see it? ')
PHP Code:
while($row mysql_fetch_array($result)){
        
$old preg_replace('#&?nbsp;?#i'' '$row['content']);
        
$new .= preg_replace("/[^ -þ]/"""$old);
        
$sql_record2 "INSERT INTO correction_nbsp (".$acronym."_pages_id, content_before, content_after)
        VALUES ("
.$row['id'].", '".$row['content']."', '".$new."')";
        
mysql_query($sql_record2,$con) or die(mysql_error());
        echo 
$sql_record2."<br />\n";
    } 
Reply With Quote