title: How to get SUM of a column in PDO query
body: <p>I am trying to get Summation of a column from my database table. But I get just 0.00. My codes are:</p>
  
  <pre><code>$total_income_query = $db-&gt;prepare("select sum(credit) from accounts WHERE STR_TO_DATE(date, '%d/%m/%Y') BETWEEN STR_TO_DATE(:startDate, '%d/%m/%Y') AND STR_TO_DATE(:endDate, '%d/%m/%Y')");
  
  $stmt-&gt;bindParam(':startDate',$startDate);
  $stmt-&gt;bindParam(':endDate',$endDate);
  $stmt-&gt;execute();
  
  $total = $stmt-&gt;fetch(PDO::FETCH_NUM);
  
  echo $total_income = $total[0];
  </code></pre>
  
  <p>It supposed to echo 306700.80. I've checked the query. It works fine in Database but not in my PHP script. What's wrong with it? </p>