2016-10-01 46 views
1

如何在PHP中重複顯示ID號然後在列表中顯示?如何在使用PHP的列表中顯示

這是我在查看

<ul class="dropdown-menu" role="menu"> 
    <li><a href="#"><?php echo ?></a></li> 
</ul> 

在控制器

$query=$this->mdl_mainmenu->notif_items(); 
$data['notifs'] = $query; 
$this->load->view('vw_main_menu',$data); 

在型號

function notif_items(){ 
    $user = $this->session->userdata("username"); 
    $this->csbrms->select("deleted_user_request.sdp_no, 
          deleted_user_request.approval_status"); 

    $this->csbrms->from('deleted_user_request'); 
    $this->csbrms->join('m_employee_masters', 'm_employee_masters.emp_no = user_request.emp_no'); 
    $this->csbrms->where('deleted_user_request.created_by',$user); 
    $this->csbrms->where('deleted_user_request.approval_status' , 'Closed'); 
    $this->csbrms->where('deleted_user_request.approval_status' , 'Resolved'); 

    $query = $this->csbrms->get(); 
    return $query->result(); 

} 
+0

' \t <?的PHP的foreach($數據[ 'notifs']爲$ DAT){?> \t \t

  • \t '。因爲我們不知道它的結構是什麼,它看起來像 –

    +0

    對不起,它是'$ vw_main_menu ['notifs']'而不是'$ data' –

    回答

    0

    改變UL標籤的代碼:

    <ul class="dropdown-menu" role="menu"> 
        <?php foreach($vw_main_menu['notifs'] as $row):?> 
         <li> 
         <a href="#"><?php echo $row['deleted_user_request.sdp_no']?></a> 
         </li> 
        <?php endforeach;?> 
    </ul> 
    
    0
    <ul class="dropdown-menu" role="menu"> 
        <?php foreach($notifs as $row):?> 
         <li> 
         <a href="#"><?php echo $row->deleted_user_request.sdp_no; ?></a> 
         </li> 
        <?php endforeach;?> 
    </ul> 
    
    相關問題