I have a function in my model to sum several columns of a table.
public static function get_sums()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query
->select('SUM'($db->quoteName(array('pb_p','pb_s','pb_t','pb_r', 'jc_p','jc_s','jc_t','jc_r','sc_p', 'sc_s','sc_t','sc_r','my_p','my_s','my_t','my_r'))));
$db->loadResults();
}
In my view.html file added
$model = $this->getModel( );
$this->get_sums= $model->get_sums();
But it throws an error
Using $this when not in object context
I am stumped trying to get this to work, can anyone offer advice where I am going wrong? TIA Steve
static
function can't have$this->
in it.