I have jQuery code that adds a response to the last <tr>
of a table like so:
var table = '<td>' + result.table.product + '</td><td>' + result.table.code + '</td><td>' + result.table.value + '</td><td>' + result.table.time + '</td>';
$('#poo tr:last').after(table);
And here is my table:
<?php
$sql="SELECT * FROM wp_scloyalty WHERE userid = '$user_id' ORDER BY date ASC";
$result=mysql_query($sql);
?>
<table id="poo" style="margin:10px 0px 0px 0px;" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><strong>Product</strong></td>
<td><strong>Code</strong></td>
<td><strong>Value</strong></td>
<td><strong>Date Redeemed</strong></td>
</tr>
<?php while($rows=mysql_fetch_array($result)){ ?>
<tr class="currentpoints">
<td><? echo $rows['product']; ?></td>
<td><? echo $rows['code']; ?></td>
<td><? echo $rows['value']; ?></td>
<td><? echo $rows['date']; ?></td>
</tr>
<? } ?>
<tr class="currentpoints">
<td id="producttd"></td>
<td id="codetd"></td>
<td id="valuetd"></td>
<td id="datetd"></td>
</tr>
</table>
My problem is that when I add more than one entry it tries to fit them all into the last tr. Is there a way to add a tr or something after the last tr has been populated?