I created a query for the zend framework in which I am trying to get the sum of a column, in this case a column called "time". This is the query I'm using:
$this->timequery = $this->db_tasks->fetchAll($this->db_tasks->select()->from('tasks', 'SUM(time)')->where('projectnumber =' . $this->value_project));
$this->view->sumtime = $this->timequery;
Repeating the request tells me that is correct. But I can not answer the result correctly. I am currently using:
echo $this->sumtime['SUM(time)'];
Return the following error:
Catchable fatal error: Object of class Zend_Db_Table_Row could not be converted to string in C:\xampp\htdocs\BManagement\application\views\scripts\tasks\index.phtml on line 46
Line 46 is an echoed line in my view.
I’ve been looking for how to understand this for two days, or am getting the same result in a different way. Tried to serialize the value, but that didn't work either.
Is there anyone who knows how to achieve the total amount of a database column?
Any help is very convenient!
note: Quite new for zend framework ...