如何使用PHP在列表中显示

时间:2016-10-01 08:37:19

标签: php html codeigniter model-view-controller html-lists

如何在PHP中重复显示ID编号?

这是我在View中的代码

<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();

}

2 个答案:

答案 0 :(得分:0)

将ul标签更改为:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">

$('textarea').keyup(function() {

    var input = $(this).val();

    // CHECK TITLE
    if (input == "{event_title}") {
        $(".eventTagTitle").addClass("true");
    } else {
        $(".eventTagTitle").removeClass("true");
    };

    // CHECK FORM
    if (input == "{event_form}") {
        $(".eventTagForm").addClass("true");
    } else {
        $(".eventTagForm").removeClass("true");
    };

    // CHECK AUTHOR
    if (input == "{event_author}") {
        $(".eventTagAuthor").addClass("true");
    } else {
        $(".eventTagAuthor").removeClass("true");
    };

    // TEST OUTPUT TO CONSOLE
    console.log(input);

});

</script>

答案 1 :(得分: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>