|
-
Jul 15th, 2008, 11:45 PM
#1
Thread Starter
Hyperactive Member
preg_replace causing to repeat
I think the preg_replace is causing the former result to repeat:
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  from  authoritative  sources  showing  the ', ' 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";
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|