thunderbird22 Posted February 21, 2011 Share Posted February 21, 2011 Hi guys, I have no idea if this is under AJAX thread, therefore if the moderators can help me, just move it to the correct area. Here is my problem. Using PHP and MySQL I retrieve information from a database and I put them in an html table. After the table is presented, I want the column headers to be clickable and when I click them I want the table to be dynamically ordered by that column. my code goes like this: if (mysql_num_rows($result) > 0) { echo '<table border=1 cellpadding=10>'; echo '<tr><td>ID</td><td>USER</td><td>DEPARTMENT</td><td>AGE</td></tr>'; while ($row = mysql_fetch_object($result)) { echo '<tr>'; echo '<td>' . $row->id; echo '</td>'; echo '<td>' . $row->user; echo '</td>'; echo '<td>' . $row->department; echo '</td>'; echo '<td>' . $row->age; echo '</td>'; echo '</tr>'; } echo '</table>' } Quote Link to comment https://forums.phpfreaks.com/topic/228421-dynamic-sorting-problem/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.