怎么解决CI_DB_mysql_result

How can solve CI_DB_mysql_result

大家好我的页面有问题我有控制器名称用户我需要从我的函数中获取值并在另一个函数中使用它但是我有问题:

消息:class CI_DB_mysql_result 的对象无法转换为字符串

文件名:database/DB_active_rec.php

行号:**

我在控制器中的代码:

function view_ind()
{
    $this->load->model('user_model');
    $username = $this->session->userdata('username');
    $data['user']=$this->user_model->get_name($username);
    $place=$this->user_model->get_place($username);
    $data['results']=$this->user_model->get_all_names_info($place);     
    $data['main_content']='view_page';
    $this->load->view('include/tem',$data);     

}   

在我的模型中:

    function get_place($user)
{
    $this->db->select('place');
    $this->db->where('username',$user)->from('users');
    return  $this->db->get();

}

    function get_all_names_info($place)
{
    $this->db->select('*');
    $this->db->from('personal_info');
    $this->db->where('place =',$place);

    return $this->db->get();
}

当需要使用 $place 显示错误信息和 $place 未定义时..我希望尽快解决我的问题...谢谢

把你的功能改成

  function get_place($user)
{
    $this->db->select('place');
    $this->db->where('username',$user)->from('users');
    return  $this->db->get();

}

function get_place($user)
{

    return $this->db->get_where('user', array('username'=>$user))->row()->place;
}