I get a string from the database, and i want to output that string with the function htmlentities or htmlspecialchars.
The problem is that when I echo the variable without htmlentities, it outputs the string just like it should, but when I echo the variable WITH htmlentities, it outputs nothing.
Code:
This works:
<h2><?php echo $row['title']; ?></h2>
<p><?php echo $row['description']; ?></p>
This doesn't work:
<h2><?php echo htmlentities($row['title']); ?></h2>
<p><?php echo htmlentities($row['description'], ENT_COMPAT, "UTF-8"); ?></p>