多個ID在MySQL表如何expload並獲得另一個MySQL表中的特定ID值笨,多個ID如何expload並獲得笨id值
頁面視圖圖像添加,
查看頁面
`<?php foreach($company_branch as $loop){ ?>
<tr>
<td></td>
<td><?=$loop->branch_name ?></td>
<td><?=$loop->branch_head ?></td>
<td><?=$loop->departments_list_id ?></td>
<td><?=$loop->write_date ?></td>
</tr>
<?php } ?>`
控制器Page
`public function company_settings() {
$data['company_branch'] = $this->settings_model->company_branch();
$this->load->view('settings/company_settings',$data);`
模型Page
`function company_branch(){
$this->db->select('company_branch.*,
company_departments.department_name as departments_name ')-
>from('company_branch');
$this->db- >join('company_departments','
company_branch.departments_list_id = company_departments.id');
$query = $this->db->get();
return $query->result();
}`
How to display the `departments_list_id ` to department names in view
page,
The image is company_branch and company_department mysql table view,
那麼問題是什麼? –
如何在瀏覽器視圖頁面部門列中顯示department_names不在id中 – kathir