database - codeigniter:无法从一个函数获取返回值到同一控制器内的另一个函数?
问题描述
我正在开发codeigniter Web应用程序,我想从get_status_dropdown_values
函数中获取数据库值并显示到contacts_list
函数中,当我尝试print
或echo
在get_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;
}
解决方案
推荐阅读
- unit-testing - 角度测试在组件中模拟 store.pipe
- xslt - XSLT 转换文件中产生的额外换行符
- c# - nopcommerce 尝试在管理面板中添加自定义选项卡
- r - 时间序列的时间百分比
- php - 无法使用 cUrl 的 set_opt 调用函数
- javascript - 如何将所有值推入数组并使用 javascript 获取它们
- arrays - VBA - 多表阵列打印表
- node.js - Heroku 错误:架构无效,应为 `mongodb` 或 `mongodb+srv`
- auraphp - Aura 路由器 AJAX 路由失败 - 找不到路由
- minizinc - 如何在 minizinc 中使用 R 或 python 生成 .dzn 文件