Making Sortable Displays
There’s one final feature that I want to add to view_users.php while I’m at it. In its current state the list of users is displayed in order by the date they registered. It would be nice to be able to view them by name as well.
From a MySQL perspective, accomplishing this task is easy: just change the ORDER BY clause. Therefore, all I need to do is add some functionality in PHP that will change the ORDER BY clause. The logical way to do this is to link the column headings so that clicking them changes the display order. As you hopefully can guess, this involves using the GET method to pass a parameter back to this page indicating the preferred sort order.
To take this concept just a little bit further, I want the sorting ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access