I'm trying to sum a column using the SUM method of mysqli. The problem is that my query does not return with results. My code is this:
$sql = 'SELECT SUM(size) as soma, porta FROM ''
.$this->options['db_table'].'' WHERE 'porta'=?';
$query = $this->db->prepare($sql);
$query->bind_param('s', $file->porta);
$query->execute();
$query->bind_result(
$soma
);
$query->close();
echo $soma;
What could be wrong? Remember that all other queries without using SUM () work perfectly.