Php problems, you will certainly. help me solve this problem.

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.