Ask a small question about how to write a PHP database.

Source: Internet
Author: User
I would like to ask where are the minor issues in writing PHP database operations? No records can be found as long as $ order value is assigned to the parameter.
But if this value is not given, five records can be found.
I think there are some syntax problems. please point your finger. thank you.

Reply to discussion (solution)

The order clause must be before the limit clause, and your code order is reversed, resulting in syntax errors. Generally, limit is the last component of an SQL statement.
By the way, you only find that the value cannot be found, which is actually an SQL statement parsing error. If you do not know how to debug and discover problems, the subsequent steps will be difficult to follow.

$ Q = 'Order by'. $ ORDER. 'desc ';

You can only use this method for one table .. So many fields are written to death...
In addition, the order by position is incorrect. first order by and then limit

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: 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.