Php problems, you will certainly, help me solve this problem. The page shows that the data read from the database is sorted by time. I want to add two buttons, one of which is sorted by age, one is sorted by time. My problem is how to execute the "select * fromlogorderbyl_age" command to sort by age. if you have a php problem, you will definitely solve it for me.
The page shows that the data read by the database is sorted by time. I want to add two buttons, one for sorting by age and the other for sorting by time.
My problem is how to execute the "select * from log order by l_age" command in the age-based sorting control ";
Select * from log order by l_time is executed in chronological order ". You can use the onclick event of submit or select. Or you can do anything better. Thank you.
------ Solution --------------------
Form
Construct a query string
$ Orderkey = isset ($ _ GET ['orderkey']) & $ _ GET ['orderkey'] = 'sort by age '? 'L _ age': 'L _ time ';
$ SQL = "select * from log order by $ orderkey ";
------ Solution --------------------
PHP code
Sort by age