title: PHP Sanitizing string when reading from database
body: <p>I'm kind of a bit of a noob when it comes to PHP, so apologies if this is very basic. This question has probably been previously asked, but I am unable to find another post with a similar case to mine.
  An example of a URL on my site is example.com/read.php?id=1. The read.php file contains the following code:</p>
  
  <pre><code>&lt;?php
      $id = $_GET['id'];
      $sql = mysqli_query($con, "SELECT * FROM pages WHERE id='$id'");
  ?&gt;
  </code></pre>
  
  <p>I know that I need to do some kind of sanitation to this, but what would be the best way of doing this in this case? Performance is critical as well, so I don't want to be adding unnecessary code.</p>