I am pulling data from a database using mysqli and PHP.
This works OK but I get a random character (black question mark) replacing apostrophes in words, so I thought I could use the htmlspecialchars()
function to have them display properly, but it doesn't work.
So my code looks like this
while($row = $result->fetch_assoc())
{
$desc = htmlspecialchars($row['description'], ENT_QUOTES);?>
<div class="timeline-key">
<div class="fluid key-content">
<p><?php echo $desc?></p>
</div>
</div><?php
}
Now any record in the database which contains an apostrophe $desc prints out nothing, all other records print out OK?
Now if I try the exact same come on a string that is not being pulled from the database it displays it OK?