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>' } Link to comment https://forums.phpfreaks.com/topic/228421-dynamic-sorting-problem/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.