AakkiRock
AakkiRock

Reputation: 220

Table style not working in PHP, MySql

The table pattern was working before adding the below line

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

but after adding the above line the table style is gone. here is the full table code, please help me in this

<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> 

Upvotes: 0

Views: 293

Answers (1)

Pupil
Pupil

Reputation: 23958

You have 5 <th>

And

6 <td>

That is why its not working.

Change:

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

To

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

Also, Change

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

To

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

Upvotes: 2

Related Questions