title: Mysqli prepared statements SUM column value
body: <p>I am trying to sum the values from a column using mysqli prepared statement with the code below but is not working. Does anyone can help me pointing what I am doing wrong? Thanks!</p>
  
  <pre><code>$stmt2 = $mysqli-&gt;prepare("SELECT SUM(col) as total FROM tb_a WHERE user=?");
  
  $stmt2-&gt;bind_param("s", $user);
  $stmt2-&gt;execute();
  $op_row = $stmt2-&gt;fetch_assoc();
  
  echo $op_row['total'];
  </code></pre>