OK, I know that what I see is not necessarily what the code says. I got that part figured out. But I have a long list of characters that need to be stored in a database as their html entities rather than as the punctuation marks. I have updated my code to this:
$searchval = array("á","–","—","/"," ","-","...","…","\&","\'","í","\[","\~","\"","\]");
$replaceval = array("\è\;","\&ndash\;","\&mdash\;","\/","\&#nbsp\;","\&#hyphen\;","\&hellip\;","\&hellip\;","\&\;","\&apos\;","\ì\;","\&lbrack\;","\ñ\;","\"\;","\&rbrack\;");
str_replace($searchval,$replaceval,$fixed);
But the entitiy names are not going into the database.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'most # rig&ht...'
How do I get the entities to go into the database rather than the punctuation marks?
<!DOCTYPE html>
<html>
<body style="margin-left:50px">
<?php
$fixed = "this is al'most right";
echo $fixed;
echo "<br>";
echo "htmlspecialchars: ";
echo htmlspecialchars($fixed, ENT_QUOTES);
echo "<br>";
echo "str_replace: ";
echo str_replace("'", "'", $fixed);
echo "<br>";
?>
</body>
</html>