title: PHP : Escaping special charters or replace them
body: <p>i want to escape special characters being fetched in  database and want to replace it with apostrohpe sign, this is how i query  database </p>
  
  <pre><code>&lt;div class="row course-boxes"&gt;
  &lt;?php $count= 0; ?&gt;
  &lt;?php 
      $query= mysqli_query($connection, "SELECT * FROM coruses_list WHERE category_id='$category' ");
      while($row=  mysqli_fetch_assoc($query)):
          $count++; 
      ?&gt;
      &lt;div class="col-md-4 col-sm-4 col-xs-12" &gt;
         &lt;h2&gt;&lt;?php echo $row['course_name'];?&gt;&lt;/h2&gt;
         &lt;p style="height: 110px; overflow: hidden;"&gt;&lt;?php echo substr($row['course_description'], 0 , 400);?&gt;...&lt;/p&gt;
             &lt;a class="btn btn-default" href="course_details.php?course=&lt;?php echo $row['course_id']?&gt;&amp;cat=&lt;?php echo $category ?&gt;"&gt;View Details&lt;/a&gt;
      &lt;/div&gt;
  &lt;?php endwhile;?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>but problem is that i am getting output like this </p>
  
  <blockquote>
    <p>The course will consist of � type</p>
  </blockquote>
  
  <p>how do i escape or convert them to another character </p>