How can I sort this foreach loop with jQuery? I will sort on id but I don’t now how to do that.
<form id="fileForm" action="#" enctype="multipart/form-data" method="get">
<table cellpadding="2" cellspacing="0" width="100%" class="grid">
<tr>
<th>ID:</th>
<th>Time:</th>
<th>Location:</th>
<th>From IP:</th>
<th>Title (url):</th>
<th></th>
</tr>
<tr>
<td>1</td>
<td>12:00</td>
<td>Utrecht</td>
<td>192.019.192.00</td>
<td>site</td>
</tr>
</table>
</form>
http://datatables.net/ – is a client side JQuery plugin which will allow you to sort/paginate etc the final HTML that your PHP renders.
I would tend to use a server-side solution though if you have 1000s upon 1000s of rows as the time it takes to initially render the page would be very long.