title: is this a safe way to use SELECT via PDO
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/60174/best-way-to-stop-sql-injection-in-php">Best way to stop SQL Injection in PHP</a><br>
    <a href="https://stackoverflow.com/questions/4364686/how-do-i-sanitize-input-with-pdo">How do I sanitize input with PDO?</a>  </p>
  </blockquote>
  
  
  
  <p>I'm pulling in an id via <code>$_GET</code>. I just started using PDO and I'm unsure if this is safe or not. Obviously, the code below is using <code>$_GET</code> to grab an id. I'm not sanitizing it at all before I place it in the query. Is this safe?</p>
  
  <pre><code>&lt;?php
  if (isset($_GET['id'])) {
  $blogid = $_GET['id'];
  $post = $dbh-&gt;query("SELECT id, title, slug, body, image, author, date, category from   blog WHERE id='$blogid' ORDER BY date DESC");
  $row = $post-&gt;fetch(); ?&gt;
  </code></pre>