dsds33222 2016-08-10 05:22
浏览 15

显示外键在模态中等于id的所有记录

I want to display all the records from transactions table to the modal where the transactions "records_id" is equal to records "ID" but then display only the current row of the looped link which is "Click Here". Sorry for my english but I hope you understand. Please anyone! Thanks!

View:

<?php foreach ($results as $row): ?> 
<tr> 
<td> <input name="checkbox_<? echo $rows['ID']; ?>" type="checkbox"              id="checkbox[]" value="1"> </td>
<td><?php echo $row->ID; ?></td>
<td><?php echo $row->last_name; ?></td>
<td><?php echo $row->first_name; ?></td>
<td><?php echo $row->middle_name; ?></td>
<td>                                                       
<a href="#transaction" data-toggle="modal"
id="<? echo $rows['ID']; ?>"> Click Here </a>
</td>                                                       
</tr>                                               
<?php endforeach; ?>

/* Modal */
<!-- Transaction Pop-Up Window -->
<div class="modal fade" id="transaction">
<div class="modal-dialog">
    <div class="modal-content">

        <!-- Transaction Header --> 
        <div class="modal-header">
            <button class="close" data-dismiss="modal"> </button>
        </div>

        <!-- Transaction Body -->
        <div class="modal-body">
            <table class="table table-striped table-bordered col-xs-12">
                <thead>
                    <tr>
                        <th> Concern </th>
                        <th> Treatment </th>
                        <th> Status </th>                                                   
                    </tr>
                </thead>    

                <tbody>
                    <?php foreach ($results3 as $row): ?>
                    <tr>
                        <td> <?php echo $row ->concern; ?> </td>
                        <td> <?php echo $row ->treatment; ?> </td>
                        <td> <?php echo $row ->status; ?> </td>
                    </tr>
                    <?php endforeach; ?>                                                    
                </tbody>                                           
            </table>
        </div>

    </div>      
    </div>
    </div>




    model:

    function display3()
{
    $query = $this->db->query('SELECT * FROM transactions, records WHERE            transactions.records_id = records.ID');
    return $query->result();
}



   controller: 

    $this -> load -> model('model_admin');
        $data['results'] = $this -> model_admin -> display();

        $this -> load -> model('model_admin');
        $data['results2'] = $this -> model_admin -> display2(); 

        $this -> load -> model('model_admin');
        $data['results3'] = $this -> model_admin -> display3(); 
        $this -> model_admin -> display3($data);    


        $this -> load -> view('admin_home_view', $data);
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 matlab(相关搜索:紧聚焦)
    • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
    • ¥15 路易威登官网 里边的参数逆向
    • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
    • ¥50 需求一个up主付费课程
    • ¥20 模型在y分布之外的数据上预测能力不好如何解决
    • ¥15 processing提取音乐节奏
    • ¥15 gg加速器加速游戏时,提示不是x86架构
    • ¥15 python按要求编写程序
    • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入