对齐表行

问题描述 投票:-1回答:1

我有这张桌子,我想要做的是将最后一行与子实体对齐。

有可能吗?如果是这样,我该怎么办?

我尝试使用此功能,但无法正常工作。我添加了许多<td>来对齐它,但是我认为有更好的方法。请帮帮我。

我的代码:

<table class="table table-dark table-hover col-lg-6" id="subjects" name="subjects">
    <thead>
    <tr>
        <th>Code</th>
        <th>Title</th>
        <th>Status</th>
        <th>Proffesor</th>
        <th>Section</th>
        <th>Classroom</th>
        <th>Time in</th>
        <th>Time out</th>
        <th>Units</th>
    </tr>
    </thead>

    <tbody>
    <?php
    $q1 ="select * from subjects";
    $ex1 = mysqli_query($conn,$q1);
    $q2 = "SELECT sum(units) AS units from subj_enrolled where studid= '1512345678' "; 
    $ex2=mysqli_query($conn,$q2);
    $fetch = mysqli_fetch_assoc($ex2);
    $check = mysqli_num_rows($ex1);
    if ($check > 0){
    while ($row=mysqli_fetch_assoc($ex1)) {?>
    <tr>
        <td> <?php echo $row['subjcode'];?></td>
        <td> <?php echo $row['subjtitle'];?></td>
        <td> <?php echo $row['subjstatus'];?></td>
        <td> <?php echo $row['profid'];?></td>
        <td> <?php echo $row['section'];?></td>
        <td> <?php echo $row['classroom'];?></td>
        <td> <?php echo $row['time_in'];?></td>
        <td> <?php echo $row['time_out'];?></td>
        <td> <?php echo $row['subjunits'];?></td>
    </tr>
    </tbody>
    <tbody>
    <?php }?>
    <tr>
        <td><?php echo "Total units: "; ?></td>
        <td> <?php echo $fetch['units'];?></td>
    </tr>
    <?php }?>
    </div>
    </tbody>
</table>
html css database-design html-table rows
1个回答
0
投票

尝试使用以下代码:

© www.soinside.com 2019 - 2024. All rights reserved.