【问题标题】:Codeigniter how to add a link to html table class displaying db queryCodeigniter如何添加链接到显示数据库查询的html表类
【发布时间】:2017-07-16 15:39:34
【问题描述】:

我正忙于使用 Codeigniter 设计网页,并且正在使用 html 表类来显示 db 查询的结果。

我想使用 html 表类添加到 db 结果的链接以删除或编辑记录。

如果有人以前这样做过,请帮助我。

【问题讨论】:

  • 一些代码可能有用。

标签: database codeigniter class hyperlink html-table


【解决方案1】:

阅读评论后,我决定发布我的解决方案。

我想知道是否有一种方法可以让 codeigniter 使用表格类生成具有以下链接的相同表格

查看

<table border="1" title="User information" id="table">
        <caption><b>User information</b></caption>
    <thead>
    <tr><th>E-mail address</th><th>Name</th><th>Last name</th><th>Home address</th>
    <th>Postel address</th><th>Mobile number</th><th>Home telephone</th><th>ID number</th>
    <th>Action</th></tr>
    </thead>    
    <tbody> 
    <?php

        foreach($results as $row){
            echo "<tr>";
            echo "<td>" . $row->email . "</td>";
            echo "<td>" . $row->name . "</td>";
            echo "<td>" . $row->lastname . "</td>";
            echo "<td>" . $row->homeaddress . "</td>";
            echo "<td>" . $row->posteladdress . "</td>";
            echo "<td>" . $row->mobile  . "</td>";
            echo "<td>" . $row->hometel  . "</td>";
            echo "<td>" . $row->idnum . "</td>";
            echo "<td><a href='" . base_url() . "index.php/user_admin/get_user_edit/$row->id'>Edit</a> &nbsp<a href='" . base_url() . "index.php/user_admin/suspend/$row->id' >Suspend</a></td>";
            echo "</tr>";
    }

    ?>
    </tbody>
   </table> 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-29
    • 2013-08-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多