0
我試圖使用Codeigniter的表格和分頁庫來顯示數據庫中的數據。在我的模型中,除了其他列之外,我想從我的表「批處理」中獲取列「batchid」的信息,但不想在顯示其他數據時在視圖文件中顯示它。顯示數據庫值
但是,因爲我已經包含在這 - 的「batchid」(以下相同)
$this->db->select('batchname, class, batchid, batchinstructor');
它顯示在視圖中的列「batchid」,這是我不希望的全部信息。我只想檢索批處理id的值來使用它來錨定「batchname」。
我試了很多,但它不會工作。你能請你幫忙嗎?
由於提前
這裏是我的模型
//Function To Create All Student List
function batch_list()
{
$config['per_page'] = 15;
$this->db->select('batchname, class,batchid, batchinstructor');
$this->db->order_by("batchid", "desc");
$rows = $this->db->get('batch',$config['per_page'],$this->uri->segment(3))->result_array();
$sl = $this->uri->segment(3) + 1; // so that it begins from 1 not 0
foreach ($rows as $count => $row)
{
array_unshift($rows[$count], $sl.'.');
$sl = $sl + 1;
$rows[$count]['batchname'] = anchor('batch_list/get/'.$row['batchid'],$row['batchname']);
$rows[$count]['Edit'] = anchor('update_student/update/'.$row['batchname'],img(base_url().'/support/images/icons/edit.png'));
$rows[$count]['Delete'] = anchor('report/'.$row['batchname'],img(base_url().'/support/images/icons/cross.png'));
}
return $rows;
}
//End of Function To Create All Student List
這裏是我的控制器
function index(){
$this->load->helper('html');
$this->load->library('pagination');
$this->load->library('table');
$this->table->set_heading('Serial Number','Batch Name','Class','Batch Instructor','Edit','Delete');
$config['base_url'] = base_url().'batchlist/index';
$config['total_rows'] = $this->db->get('batch')->num_rows();
$config['per_page'] = 15;
$config['num_links'] = 5;
$config['full_tag_open'] = '<div class="pagination" align="center">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
$data['tab'] = "Batch List";
$this->load->model('mod_batchlist');
$data['records']= $this->mod_batchlist->batch_list();
$data['main_content']='view_batchlist';
$this->load->view('includes/template',$data);
}
和你的視圖文件在哪裏? – user973254