title: How do you fetch one single record from a MySQL database using a PDO prepared statement?
body: <p>How do you fetch <strong>one single record</strong> from a MySQL database using a PDO prepared statement?</p>
  
  <p>In the "old" way of doing it, I could use:</p>
  
  <pre><code>$MyCaption = mysql_result(mysql_query("SELECT * FROM `photos` WHERE `id` = '56465843362'"),0,"caption");
  </code></pre>
  
  <p>What would be the PDO prepared statement equivalent?</p>
  
  <p>I tried:</p>
  
  <pre><code>$id = '56465843362';
  $query = $db-&gt;prepare("SELECT `caption` FROM `photos` WHERE `id` = ?");
  $query-&gt;execute(array($id));
  $caption = $query-&gt;fetchColumn();
  </code></pre>
  
  <p>... but that was wrong.</p>