So I promised this morning, it's now almost Sunday... oops...
First off I have to agree, XML has no problem with &, in fact I've been using it without problems for quite a while. I prefer # codes myself.
But I have some code to spit out and see if anyone can pinpoint my problem. For starters lets get the function that swaps the code... Pretty generic preg_replace
function seaReplace($temp) {
$search = array ("'<script[^>]*?>.*?</script>'si", // Strip out javascript
"'&(?!amp);?'i",
"'&(lt|#60);'i",
"'&(gt|#62);'i",
"'—|&(mdash);'i",
"'–|&(ndash);'i",
"'¤|&(curren);'i",
"'°|&(deg);'i",
"'®|&(reg);'i",
"'™|&(trade);'i",
"'&(#8756|there4);'i",
"'…|&(#8230|hellip);'i",
"'¡|&(iexcl|#161);'i",
"'¢|&(cent|#162);'i",
"'£|&(pound|#163);'i",
"'€|&(euro);'i",
"'©|&(copy|#169);'i",
"'’|&(rsquo);'i",
"'«|&(ldquo);'i",
"'»|&(rdquo);'i",
"'É|&(Eacut);'i",
"'•|&(bull);'i",
"'é|&(eacute);'i");
$replace = array ("",
"&",
"<",
">",
"—",
"–",
"¤",
"°",
"®",
"™",
"∴",
"…",
"¡",
"¢",
"£",
"€",
"©",
"’",
"“",
"”",
"É",
"•",
"é");
$var = preg_replace ($search, $replace, $temp);
return $var;
}
And this is the code that calls a function to do the slashes for quotes and that function...
else {
$cleanVal = $this->cleanFields($val,$key);
$sqlUpdate = "UPDATE " . $this->tabName . " SET " . $key . "='$cleanVal' WHERE id=" . $_POST['id'] . "";
//print ($sqlUpdate . "<br />\n");
mysql_query($sqlUpdate,$GLOBALS['db']) or die (mysql_error());
}
And this is what I see on the screen...
<blockquote><p>If all else fails, tell the truth…</p></blockquote><p>This is from <a href=\"http://www.amazon.com/exec/obidos/tg/detail/-/0751501999/qid=1082121101/sr=1-5/ref=sr_1_5/102-5900828-8304145?v=glance&s=books\">Stark</a> by Ben Elton. I borrowed this from my <a href=\"http://recently.rainweb.net/hive/215/\" title=\"Greetings from Ireland\">distant cousins in Ireland</a>. It\'s a good book, I\'m just having a hard time getting engrossed in it where I read for 6 hours straight and I\'ve been trying to read it for almost a year.</p>' WHERE id=504
But what actually is in the database is...
<blockquote><p>If all else fails, tell the truth&#8230;</p></blockquote><p>This is from <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0751501999/qid=1082121101/sr=1-5/ref=sr_1_5/102-5900828-8304145?v=glance&s=books">Stark</a> by Ben Elton. I borrowed this from my <a href="http://recently.rainweb.net/hive/215/" title="Greetings from Ireland">distant cousins in Ireland</a>. It's a good book, I'm just having a hard time getting engrossed in it where I read for 6 hours straight and I've been trying to read it for almost a year.</p>
Notice the extra & tacked on the ellipsis, & amp;#8230;
I could understand if it just went through the whole thing twice, but I'm spitting out the sql statement going in. And it doesn't seem to end up exactly the way it was supposed to. Any help would be greatly appreciated. 🙂 Thanks everyone.