Codeigniter如何添加链接到显示db查询的html表类

时间:2015-02-28 20:29:26

标签: database codeigniter class hyperlink html-table

我正忙着使用Codeigniter设计网页,我正在使用html表类来显示数据库查询的结果。

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

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

1 个答案:

答案 0 :(得分:0)

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

我想知道是否有一种方法可以让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>