![](/img/trans.png)
[英]Joining 2 Tables and show the same column repeatedly based on its associative ID
[英]How to show 2 value with same column different id in same tables
我想將數據提取到表中,我在 1 行數據中有 3 個 id_user 具有不同的值,我無法弄清楚我必須為顯示我的 id_user 的 3 個全名做什么,每次我添加另一個全名總是相同的值時出來,這是我的代碼:
//樣本:
tbl_dokumen (
id_user int(11) NOT NULL,
id_qhse int(11) NOT NULL,
id_kbidang int(11) NOT NULL;
Model
public function pengirim()
{
$this->db->select('a.*,b.full_name,c.nama_departement, d.nama_jenis, e.nama_leveld,f.nama_progres,g.nama_section');
$this->db->join('tbl_user b', 'a.id_user=b.id_user');
$this->db->join('tbl_departement c', 'a.id_departement=c.id_departement');
$this->db->join('tbl_jenis_dokumen d', 'a.id_jenis=d.id_jenis');
$this->db->join('tbl_level_dokumen e', 'a.id_leveld=e.id_leveld');
$this->db->join('tbl_progres f', 'a.status=f.id_progres');
$this->db->join('tbl_section g', 'a.id_section=g.id_section');
return $this->db->order_by('id_dokumen ASC')
->get('tbl_dokumen a')
->result();
}
這是我的觀點:
<?php
$no = 1;
foreach ($pengirim as $pe) {
?>
<tr>
<td><?php echo $no++ ?></td>
<td><?php echo $pe->kode_dokumen ?></td>
<td><?php echo $pe->nama_dokumen ?></td>
<td><?php echo $pe->full_name ?></td>
<td><?php echo $pe->created_at ?></td>
<td><?php echo $pe->update_at ?></td>
<td><?php echo $pe->nama_progres ?></td>
</tr>
<?php } ?>
您想在第一行顯示所有用戶的全名嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.