用PHP排序表

How to sort table in php?

I have code like this

<th>$ATTT[0]</th>
        <td>".number_format($HA[0], 3, '.', ',')."</td>
        <td class='jumlah'>1</td>
        </tr>
        <th>$ATTT[1]</th>
        <td>".number_format($HA[1], 3, '.', ',')."</td>
        <td class='jumlah'>2</td>

I want to sort column 2, so when column 2 sorting column 1 will follow column 2

my table

Sorry for my English, I tried my best :D

In that case there are two options, use order by in your query so that you get the data in some order or use JQUERY datatable plug-in which have so many features like sorting, searching, pagination etc. It can be used like:

$(document).ready(function(){
    $('#myTable').DataTable();
});

Reference

Demo

How to implement