客户表输入图片描述
<<p>siteproducts表/strong>输入图片描述我想显示当前登录用户的记录产品详细信息
例如:客户编号15已登录,那么记录应该只显示他的记录
public function customerparcelstatus()
{
$this->db->select('*');
$this->db->from('siteproducts');
$this->db->join('customer', 'siteproducts.customer_id=customer.customer_id');
//$this->db->order_by('customer.customer_id');
return $this->db->get()->result_array();
}
控制器
public function custparcelstatus()
{
$this->load->model('orbitcustomer_model');
$data['parcellistview'] = $this->orbitcustomer_model->customerparcelstatus();
$this->load->view('customer/customer_dashboard', $data);
}
<<p>视图/strong><tbody>
<?php if (!empty($parcellistview)) { foreach($parcellistview as $user) {?>
<tr>
<td><?php echo $user['customer_id']; ?></td>
<td><?php echo $user['customer_code']; ?></td>
<td><?php echo $user['product_code']; ?></td>
<td><?php echo $user['received_date']; ?></td>
<td><?php echo $user['received_from']; ?></td>
<td><?php echo $user['tracking_ref_no']; ?></td>
<td><?php echo $user['parcel_status']; ?></td>
<td><?php echo $user['parcel_note']; ?></td>
</tr>
<?php } } else { ?>
<tr>
<td>Norecords Found</td>
</tr>
<?php } ?>
您需要通过在查询中使用where子句检索与当前登录的客户相关的记录,如下所示。
$this->db->where('customer_id', $customer); //currently logged in user