从mysql数据库中计算codeigniter中的值

I just jump in codeigniter where I believe it so hard to learn in Model and Controller but where Viewes is good. I am facing an issue to creating a calculation (adding +) function in codeigniter.

Actually in my database I save the values like this:-

-------------------------------------------
ID  |  Name      |  Amount   |  DATE
-------------------------------------------
01  | Product 1  |  $250     | 20/09/1996
02  | Product 2  |  $200     | 20/09/1996
03  | Product 3  |  $210     | 20/09/1996
04  | Product 4  |  $260     | 20/09/1996
05  | Product 5  |  $280     | 20/09/1996

I want add all amount value so that I created this code and added in model

public function countTotalToday()
    {
        date_default_timezone_set('Asia/Mumbai');
        $now = date('d-m-Y');
        //$sql = "SELECT amount FROM orders_item WHERE date = '$now'";
        $sql = "sum(amount) from order_item where date(dateCol)=date(now())";
        $query = $this->db->query($sql);
        //return $query->num_rows();
    }

and in controller i make like this

$this->data['total_paisa'] = $this->model_brands->countTotalToday();

and in Views

<h3 style="display:inline;"><?php echo $total_paisa ?></h3><h5 style="display:inline; vertical-align:center;">(Sleep <?php echo $total_paisa ?>)</h5>

But the code says error 500, I don't know i fixed this, could you help me how oi make the code which works to calculate the value as amount and echo me in views with calculation in Adding method.

According to your provided table data you don't have date column. So no need to add where condition

Try like this

public function countTotalToday()
{
    date_default_timezone_set('Asia/Mumbai');
    $now = date('d-m-Y');
    $this->db->select('SUM(amount) AS amount');
    $qwer = $this->db->get('order_item')->result();
}

If you want to add the condition. Use this

$this->db->where('column-name', $value);