line 20: $this->data['available_credits'] = $total_credits - $used_credits;
function index() {
$user_id = $this->session->userdata('user_id');
$this->data['credits'] = $this->credit_m->get_credit_details($user_id);
$total_credits = $this-&g开发者_Python百科t;data['total_credits'] = $this->credit_m->get_total_credits($user_id);
$used_credits = $this->data['used_credits'] = $this->credit_m->get_used_credits($user_id);
$this->data['available_credits'] = $total_credits - $used_credits;
$this->template->build('credits_view',$this->data);
}
I'm guessing your $total_credits
variables $used_credits
don't contain numbers -- they probable contain some objects, which cannot be substracted.
Check what your get_total_credits()
and get_used_credits()
methods return ; make sure they return values that can be used with the substraction operator.
精彩评论