1 回答
TA贡献1797条经验 获得超4个赞
客户端控制器代码:-
class Client extends CI_Controller
public function index()
{
$this->load->model('Client_model');
$data['clientData'] = $this->Client_model->All();
$this->load->view('admin/ViewClient', $data);
}
}
Client_model 型号代码:-
class Client_model extends CI_model
{
function All()
{
return $client = $this->db->get('client')->result_array();
}
}
ViewClient 查看页面:-
<table>
<thead>
<tr>
<th>S.NO</th>
<th>client Name</th>
<th>Product Name</th>
</tr>
</thead>
<tbody>
<?php if(!empty($clientData)) {
$count=1;
foreach($clientData as $client){
?>
<tr>
<td><?php echo $count; ?></td>
<td><?php echo $client['clientName']; ?></td>
<td><?php
$pid = $client['productNameId'];
$pdata = $this->db->get_where('productTable',array('productId '=>$pid))->row();
echo $pdata->productName; ?>
</td>
</tr>
<?php $count++;
} }
?>
</tbody>
</table>
- 1 回答
- 0 关注
- 92 浏览
添加回答
举报