Welcome Guest, Not a member yet? Register   Sign In
Summing Data in a Table
#1

[eluser]Einspruch[/eluser]
I am a noob so forgive me if this question is way too simple or way too complex. But here goes:

I have a function in a model that pulls royalty by partner by month. I use the following code in the controller to call the function:

Code:
function royalty_by_partner()
    {
        $this->load->model('partner_model');
        $data['query'] = $this->partner_model->royalty_by_partner();
        $this->load->view('partner/royalty_by_partner', $data);
    }

The data--royalty by partner--is then rendered in a table. All is well. Until I was asked to add a row at the bottom of the table summarizing the data (i.e., total royalty revenue for the month).

My first thought was to create a separate function in the same model that sum royalty revenue by month and have the same controller function pass it to the view. Then I would render it in a separate table, but to the user it would look like a single table with a summary line.

So my question is the following: how do I pass both sets of data (two functions within the same model) to a single view? Is it possible given the structure of my controller/function?


Messages In This Thread
Summing Data in a Table - by El Forum - 05-21-2009, 05:28 PM
Summing Data in a Table - by El Forum - 05-21-2009, 07:34 PM
Summing Data in a Table - by El Forum - 05-21-2009, 11:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB