title: PHP PDO returning single row
body: <p>I have the following script which is good IMO for returning many rows from the database because of the &quot;foreach&quot; section.</p>
  <p>How do I optimize this, if I know I will always only get 1 row from the database.  If I know I will only ever get 1 row from the database, I don't see why I need the foreach loop, but I don't know how to change the code.</p>
  <pre><code>$STH = $DBH -&gt; prepare( &quot;select figure from table1&quot; );
  $STH -&gt; execute();
  $result = $STH -&gt; fetchAll();
  foreach( $result as $row ) {
      echo $row[&quot;figure&quot;];
  }
  </code></pre>