2015-07-11 75 views
0

我可以知道在我的表格中,如何在支付ID和更新付款列之間添加一列,但無法調試?我的代碼如下。 注意:由於我沒有足夠的聲望,我無法發佈圖片。HTML表格中的額外列

<td width="52">Bookng id</td>  
    <td width="78">Deposit</td> 
    <td width="149">Total_amt_paid</td> 
    <td width="149">Balance</td> 
    <td width="149">Payment status</td> 
    <td width="57">Card type</td> 
    <td width="62">Total price</td> 
    <td width="94">Payment id</td> 
    <td width="62"></td> 
    <td width="293">Update Payment</td> 
    </tr> 
    <?php do { ?> 
    <tr> 
    <th height="45"><?php echo $row_RecordsetUpdatePayment['Booking_id']; ?></th> 

    <th><?php echo $row_RecordsetUpdatePayment['Deposit']; ?></th> 
    <th><?php echo $row_RecordsetUpdatePayment['Total_amt_paid']; ?></th> 
    <th><?php echo $row_RecordsetUpdatePayment['Balance']; ?></th> 
    <th><?php echo $row_RecordsetUpdatePayment['Payment_status']; ?></th> 
    <th><?php echo $row_RecordsetUpdatePayment['Card_type']; ?></th> 
    <th><?php echo $row_RecordsetUpdatePayment['Total_price']; ?></th> 
    <th><?php echo $row_RecordsetUpdatePayment['Payment_id']; ?></th> 
    <th><?php if($row_RecordsetUpdatePayment['Payment_status'] == 'Fully Paid'){ 
       echo "<th><span style='color:grey' href='UpdatePayment.php?Payment_id=".$row_RecordsetUpdatePayment['Payment_id']."'> Update</span></th>"; } 
       if($row_RecordsetUpdatePayment['Payment_status'] == 'Partial'){ 
       echo "<th><a href='UpdatePayment.php?Payment_id=".$row_RecordsetUpdatePayment['Payment_id']."'> Update</a></th>"; 
       } 
       ?> 
      </th> 
+0

您在第一個tr中有一個額外的列()。這是你指的是什麼? – Mindastic

+0

嗨,如果我沒有把額外的列,「更新付款」文本列將進入空白列,我的「更新」鏈接列將進入第二列,留下標題空白。它會變成2個分隔的列而不是一個列 –

回答

0

從你的標題行刪除多餘的<td>

<tr> 
    <td width="52">Bookng id</td>  
    <td width="78">Deposit</td> 
    <td width="149">Total_amt_paid</td> 
    <td width="149">Balance</td> 
    <td width="149">Payment status</td> 
    <td width="57">Card type</td> 
    <td width="62">Total price</td> 
    <td width="94">Payment id</td> 
    <td width="293">Update Payment</td> 
</tr> 
+0

嗨,如果我沒有把額外的列,「更新付款」文本列將進入空白列,我的「更新」鏈接列將進入第二列留下標題空白。它會變成2個分隔的列而不是一個列 –

+0

您是否想要有兩列,因此您可以掃描一列滿並且另一列用於部分?或者你是否想要有一列可以是全部或部分? –

1

我看到你的代碼的兩個問題:

首先,你應該得到的第一行中擺脫你的空

<tr> 
    <td width="52">Bookng id</td>  
    <td width="78">Deposit</td> 
    <td width="149">Total_amt_paid</td> 
    <td width="149">Balance</td> 
    <td width="149">Payment status</td> 
    <td width="57">Card type</td> 
    <td width="62">Total price</td> 
    <td width="94">Payment id</td> 
    <td width="293">Update Payment</td> 
</tr> 

其次,您打開<th>標籤並檢查ac ondition內並打開狀態中一個新的<th>標籤,所以你的代碼應該是這樣的:

<th><?php echo $row_RecordsetUpdatePayment['Deposit']; ?></th> 
<th><?php echo $row_RecordsetUpdatePayment['Total_amt_paid']; ?></th> 
<th><?php echo $row_RecordsetUpdatePayment['Balance']; ?></th> 
<th><?php echo $row_RecordsetUpdatePayment['Payment_status']; ?></th> 
<th><?php echo $row_RecordsetUpdatePayment['Card_type']; ?></th> 
<th><?php echo $row_RecordsetUpdatePayment['Total_price']; ?></th> 
<th><?php echo $row_RecordsetUpdatePayment['Payment_id']; ?></th> 
<?php if($row_RecordsetUpdatePayment['Payment_status'] == 'Fully Paid') { 
    echo "<th><span style='color:grey' href='UpdatePayment.php?Payment_id=".$row_RecordsetUpdatePayment['Payment_id']."'> Update</span></th>"; 
} else { 
echo "<th><a href='UpdatePayment.php?Payment_id=".$row_RecordsetUpdatePayment['Payment_id']."'> Update</a></th>"; 
} ?> 

這應該是它。

+0

嗨,感謝Mindastic。有用!! –

+0

優秀。請考慮將這個答案標記爲正確的,如果這真的幫助你解決你的問題。謝謝。 – Mindastic

+0

如何標記? –