【问题标题】:First Index Number Pop Up Last in Table第一个索引号在表中最后弹出
【发布时间】:2017-02-01 22:48:36
【问题描述】:

我正在使用 SB Admin Bootstrap。

我的表格没有按应有的方式运行(应该是用户可以搜索表格中的数据并且数据排列良好),但是:

这是我的 php 代码:

<div class="box-content">
    <?php
        if ($result) {
    ?>
        <table class="table table-striped table-bordered bootstrap-datatable datatable">
          <thead>
            <tr>
                <th class="text-left">User ID</th>
                <th class="text-left">Username</th>
                <th class="text-left">Password</th>
                <th class="text-left">Full Name</th>
                <th class="text-left">Task</th>
            </tr>
        </thead>
    <?php
        while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
            echo '
            <tbody>
            <tr>
                <td class="center">' . $row['userid'] . '</td>
                <td class="center">' . $row['username'] . '</td>
                <td class="center">' . $row['password'] . '</td>
                <td class="center">' . $row['fullname'] . '</td>
                <td class="center">
                <a class="btn btn-success" href="#">
                    <i class="halflings-icon white zoom-in"></i>                                            
                </a>
                <a class="btn btn-info" href="#">
                    <i class="halflings-icon white edit"></i>                                            
                </a>
                <a class="btn btn-danger" href="#">
                    <i class="halflings-icon white trash"></i> 

                </a>
            </td>
            </tr>
            </tbody>';
        }}
    ?>
        </table>  
</div>

【问题讨论】:

    标签: php html twitter-bootstrap html-table admin


    【解决方案1】:

    答案来自评论

    您正在重复 &lt;tbody&gt; 元素,因此脚本只是获取此标记的第一次出现并执行一些功能,而将所有后续的 &lt;tbody&gt; 保持不变。

    移出循环,在表中必须是唯一的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-16
      • 2013-09-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-14
      • 1970-01-01
      相关资源
      最近更新 更多