表格样式在PHP,MySql中不起作用


Table style not working in PHP, MySql

在添加以下行之前,表格模式正在工作

echo "<td><a href='get_file.php?quote_id=" . $row['quote_id'] ."'>Download</a></td>"; 

但是添加上述行后,表格样式消失了。这是完整的表格代码,请帮助我

<div class="table-responsive">
    <table class="table table-striped table-bordered table-hover" id="dataTables-example">
        <thead>
            <tr>
                <th>Quote ID</th>
                <th>File Name</th>
                <th>File</th>
                <th>Size</th>
                <th>Created</th>
            </tr>
        </thead>
         <tbody>
          <?php
            while($row = $result->fetch_assoc()) {
            if ($row["status"]!="Approved")
            {
                 echo "<tr>";
                 echo "<td>" . $row['quote_id'] . "</td>";
                 echo "<td>" . $row['name'] . "</td>";
                 echo "<td>" . $row['mime'] . "</td>";
                 echo "<td>" . $row['size'] . "</td>";
                 echo "<td>" . $row['created'] . "</td>";
                 echo "<td><a href='get_file.php?quote_id=" . $row['quote_id'] ."'>Download</a></td>";  
                 echo "</tr>";
            }}
            ?>
         </tbody>
     </table>
</div> 

你有 5 个<th>

6 <td>

这就是为什么它不起作用的原因。

改变:

<tr>
    <th>Quote ID</th>
    <th>File Name</th>
    <th>File</th>
    <th>Size</th>
    <th>Created</th>
</tr>

<tr>
    <th>Quote ID</th>
    <th>File Name</th>
    <th>File</th>
    <th>Size</th>
    <th>Created</th>
    <th>Download</th>
</tr>

另外,更改

echo "<td><a href='get_file.php?quote_id=" . $row['quote_id'] ."'>Download</a></td>"; 

echo '<td><a href="get_file.php?quote_id=' . $row['quote_id'] .'">Download</a></td>';