Reputation: 5
<?php $q = $this->db->query("select SUM(pocet_dni) as pocet from holiday where teacher_id="._get_current_user_id($this));
$pocet_dni = $row['pocet'];
echo $pocet;
?>
I can not echo SUM. What is wrong?
Upvotes: 0
Views: 66
Reputation: 1358
$pocet
does not exists. Use row_array()
.
$q = $this->db->query("select SUM(pocet_dni) as pocet from holiday where teacher_id="._get_current_user_id($this))->row_array();
$pocet = $q['pocet'];
echo $pocet;
Upvotes: 2