无法使用CodeIgniter和MySQL将stdClass类的对象转换为int

问题描述

使用CodeIgniter遇到麻烦。我正在尝试从MysqL获取金额的值。 MysqL表包含一个名为amount的字段。我正试图从另一个表的另一个值中减去它。

$invest = $this->deshboard_model->my_total($user_id);
    $balance = $this->deshboard_model->my_total_balance($user_id);
    //s$invest = $this->db->select('amount')->from('investment')->where('user_id',$user_id)->get()->num_rows();
    //$data['team_bouns'] = $this->db->select('deposit_amount')->from('deposit')->where('user_id',$user_id)->get()->num_rows();
    //$data['team_bouns'] = $this->db->select('deposit_amount')->where('user_id',$user_id)->get('deposit')->row();
    $data['team_bouns'] = ($balance - $invest);
    $data['title']   = display('home'); 

    $data['content'] = $this->load->view('customer/dashboard/home',$data,true);
    $this->load->view('customer/layout/main_wrapper',$data);  

这是我的观点

<?PHP echo $team_bouns; ?>

我收到此错误

stdClass类的对象无法转换为int。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)