我試圖從數據庫中獲取產品詳細信息並以引導模式顯示。請有人可以幫助我。
查看頁面如何檢索在codeigniter中彈出的引導模式中顯示的數據
<table id="myTable" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>name</th>
<th>Email Address</th>
</tr>
</thead>
<tbody>
<?php foreach ($get_data as $row) : ?>
<tr>
<td><?php echo $row-> id; ?></td>
<td><?php echo $row-> name; ?></td>
<td><?php echo $row-> email; ?></td>
</tr>
<td>
<?php edited(base_url('Department/retrive_data/'.$row-> id));?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
控制器:我寫我retrive代碼在控制器頁面
public function retrive_data($id=null){
if($this->Department_m->retrive_data($id)){
$data= [];
$data['dept_info'] = 'dept/view';
$data['dept_data'] = $this->Department_m->retrive_data($id);
$this->load->view('dashboard_layout',$data);
}
else {
redirect(base_url('department/department'));
}
}
模式:我寫我retrive代碼在車型頁面
public function retrive_data($id){
$query = $this->db->get_where('tbl_dept', array('id' => $id));
if ($query->num_rows()==1) {
return $query->result();
}
else {
return FALSE;
}
}
引導模式的看法:我使用同樣的觀點pages.but不能顯示檢索數據。如何解決它?請幫幫我....
<div class="modal fade" id="dept_Update" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Basic Informetion</h4>
</div>
<?php if(isset($dept_data)){?>
<div class="modal-body">
<table class="table dt-responsive zero-border">
<tbody>
<input type="text" name="dept_code" id="dept_code" class="form-control" value="<?php echo $dept_data-> id; ?>"/>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-default">Update</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<?php } ?>
</div>
</div>
請出示研究的證據進行,你已經實現了代碼和您所遇到的確切問題...請參閱[如何提問](HTTP: //stackoverflow.com/help/how-to-ask)並考慮提供[最小,完整和可驗證示例](http://stackoverflow.com/help/mcve) – David
我正在編輯我的文章。請再次檢查並幫助我... – Rohit