The main page contains buttons that process the same request, but with different search terms
(select id, name from table where yx = 1; select id, name from table where yx = 2 ...)
Query results are processed and displayed on a separate page.
Tell me how you can sort the resulting list?
Answer 1, authority 100%
Add an ORDER BY: construct to the end of the query
select id, name from table where yx = 1 ORDER BY id ASC;
ASC – sort in ascending order
DESC – sort descending
You can also combine fields and ways of sorting them:
select id, name from table where yx = 1 ORDER BY id ASC, name DESC;