首页 > 解决方案 > codeigniter:无法从一个函数获取返回值到同一控制器内的另一个函数?

问题描述

我正在开发codeigniter Web应用程序,我想从get_status_dropdown_values函数中获取数据库值并显示到contacts_list函数中,当我尝试printechoget_status_dropdown_values函数中它向我显示数据库值时,无法将值获取到contacts_list函数中?

联系人列表函数

public function contacts_list(){
    //$this->output->nocache();
    $data['page_title'] = 'Contacts';
    $data['body'] = 'contacts/contacts_list';

    $table = 'contact_type';
    $where['where'] = array('user_id'=>$this->user_id);

    $info = $this->basic->get_data($table,$where);
    $data['get_contact_group'] = $this->basic->get_contact_group($table,$where);
    $data['dynamic_email_temp'] = $this->basic->get_email_template();

    foreach ($info as $key => $value) {
        $result = $value['id'];
        $data['contact_type_id'][$result] = $value['type'];
    }


     $info2 = $this->get_status_dropdown_values();


   $this->_viewcontroller($data);
}

get_status_dropdown_values 函数

function get_status_dropdown_values() {

    $currentpassword = array();
    $table_id = $this->input->post("ids",true);
    $row = $this->db->query("SELECT status from contact where id IN('$table_id')")->row();
    echo $currentpassword = $row->status;

    return $currentpassword;
}

标签: databasefunctioncodeignitercontroller

解决方案


推荐阅读