title: How do I add nl2br and htmlentities in this code
body: <p>I'm in need of some help. How can I output the nl2br() and htmlentities() functions into my code? Both need to be applied to 'content' but htmlentities to 'title'.</p>
  
  <pre><code>&lt;?php
  $sql = "
      SELECT    
          post.id AS postid, post.title AS title, post.created, 
          DATE_FORMAT(Created, '%d-%m-%Y') AS created,
          post.content AS content, post.image AS image,
          post.alttext AS alttext, blog.id, blog.blogname
      FROM
          post
      LEFT JOIN  
          blog ON post.blogid = blog.id
      WHERE      
          blogid = \"" .(int)$_GET['id'] . "\"
      ORDER BY   
          postid DESC";
  
  $results = $db-&gt;query($sql);
  
  if ($results-&gt;num_rows) {
      while ($row = $results-&gt;fetch_object()) {
          echo "&lt;hr&gt;
                  &lt;h3&gt;{$row-&gt;title}&lt;/h3&gt;
                  &lt;p&gt;{$row-&gt;created}&lt;/p&gt;
                  &lt;p&gt;
                      &lt;div id='blog-image'&gt;
                          &lt;img src='images/{$row-&gt;image}' alt='{$row-&gt;alttext}'&gt;
                      &lt;/div&gt;
                      {$row-&gt;content}
                  &lt;/p&gt;";
      }
  } else {
      echo 'No Results';
  }
  ?&gt;
  </code></pre>