title: Checking result before using $stmt -> fetch()
body: <p>probably a stupid question. I have the following code:</p>
  
  <pre><code>while ($stmt -&gt; fetch()) {
      echo "&lt;p&gt;&lt;strong&gt;" .$name. "&lt;/strong&gt;&lt;br /&gt;" .$comment. "&lt;/p&gt;";
  }
  </code></pre>
  
  <p>I would like to execute the while ONLY if $stmt -> fetch() returns at least one row (this is a SELECT query).. but if I do</p>
  
  <pre><code>if ($stmt -&gt; fetch())
  </code></pre>
  
  <p>It gets executed already one time, and I want to avoid this. Any clue?</p>
  
  <p>Thanks in advance.</p>