I’m able to query the database and generate a table of results. I’d like the user to be able to sort those results based on the titles for each column. How can I do that?
Sorting content on the front end of your site would usually be done with JavaScript and is beyond what you’ll find here. There is a simple example of doing it here https://www.w3schools.com/howto/howto_js_sort_table.asp.