title: PHP PDO Preprared row count not working
body: <pre><code>$sql = "SELECT count(name) FROM `TABLE` WHERE name='$name' ";
  $sth=$conn-&gt;prepare($sql);
  $totalrows = $sth-&gt;fetch(PDO::FETCH_ASSOC);
  
  echo "$totalrows";
  </code></pre>
  
  <p>This is my code to count the total number of rows using PHP PDO Prepare statement, but <code>$totalrows</code> echo nothing, it has no value. What is the mistake in this code? </p>