Welcome Guest, Not a member yet? Register   Sign In
Select Sum and Undefined Property Issue
#1

[eluser]blupixelz[/eluser]
I'm new to MVC and IC and I need some help with "select sum."

I have the following code and I keep on getting the following error - "Undefined property: CI_DB_mysql_result::$total_price"

I thought I had already defined a new property name 'total_price'...

This is what I want it to do in MySQL...
Code:
SELECT SUM(price) AS 'total_price' FROM movies
WHERE year(date_added) = '2007'

And I'm sure that this is exactly same as the MySQL statement above.
Code:
$this->db->select_sum('movies.price','total_price');
$this->db->where('year(movies.date_added)',$_POST['year']);
$data['query_total'] = $this->db->get('movies');

But why is my IC code causing an error in View?
Code:
<?=$query_total->total_price?>


Messages In This Thread
Select Sum and Undefined Property Issue - by El Forum - 03-02-2008, 08:53 AM
Select Sum and Undefined Property Issue - by El Forum - 03-02-2008, 08:58 AM
Select Sum and Undefined Property Issue - by El Forum - 03-02-2008, 09:06 AM
Select Sum and Undefined Property Issue - by El Forum - 03-02-2008, 09:08 AM
Select Sum and Undefined Property Issue - by El Forum - 03-02-2008, 09:21 AM
Select Sum and Undefined Property Issue - by El Forum - 03-02-2008, 09:26 AM
Select Sum and Undefined Property Issue - by El Forum - 03-02-2008, 09:53 AM
Select Sum and Undefined Property Issue - by El Forum - 05-08-2012, 04:04 AM
Select Sum and Undefined Property Issue - by El Forum - 05-08-2012, 05:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB