Welcome Guest, Not a member yet? Register   Sign In
Outputting Select Sum
#1

[eluser]tecrik[/eluser]
Hey -

I am trying to output the sum of a database column. The calculations seem to work but the output is not a single number but an array which looks like this:

Array ( [SUM(summe)] => 592299 )

How do I get CI to only show '592299'? I pasted the relevant code below.

Thanks!


Model:
Code:
function revenue ()
    {
    $query = $this->db->select('SUM(summe)', FALSE)
    ->from('orders')
    ->where('hidden', 0)
    ->get();
                                            
    return $query->row_array();
    }

Controller:
Code:
...
$data['revenue'] = $this->m_bestellung->revenue();
        
    $content = $this->parser->parse('bestellungen/template', $data, true);
    $this->view_template($content, $data);
    }

View:
Code:
...
<?php
print_r ($revenue);
?>
..


Messages In This Thread
Outputting Select Sum - by El Forum - 08-25-2009, 09:17 AM
Outputting Select Sum - by El Forum - 08-25-2009, 09:24 AM
Outputting Select Sum - by El Forum - 08-25-2009, 09:38 AM
Outputting Select Sum - by El Forum - 08-25-2009, 10:16 AM
Outputting Select Sum - by El Forum - 08-25-2009, 11:14 AM
Outputting Select Sum - by El Forum - 08-25-2009, 11:19 AM
Outputting Select Sum - by El Forum - 08-26-2009, 02:32 AM
Outputting Select Sum - by El Forum - 08-26-2009, 02:47 AM
Outputting Select Sum - by El Forum - 08-26-2009, 09:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB