0
我想使用CodeIgniter在數據庫中更新數據!但我有一個問題Codeigniter foreach未定義的變量更新數據在
查看
<?php foreach ($single_user as $user): ?>
控制器
$id = $this->uri->segment(3);
$data['user'] = $this->authentication->show_students();
$data['single_user'] = $this->authentication->show_student_id($id);
圖書館
function show_students(){
$query = $this->ci->db->get('users');
$query_result = $query->result();
return $query_result;
}
function show_student_id($data){
$this->ci->db->select('*');
$this->ci->db->from('users');
$this->ci->db->where('id', $data);
$query = $this->ci->db->get();
$result = $query->result();
return $result;
}
您是否加載了認證庫? –
你能描述一下實際的問題嗎? –
I load public function __construct() parent :: __ construct(); $ this-> load-> helper(array('form','url')); $ this-> load-> library('authentication'); } – deadd1wer