SQL statements generated by the thinkphp3.1 view model cannot be executed

Source: Internet
Author: User
In making an order system, you can't print anything when using a view model.
Custom View Model
 
  Array (' id ', ' orderno ', ' Date ', ' money ', ' Memo ', ' state ', ' _type ' = ' left '), ' client ' = = Array (' ClientName ', ' _on ' = > ' order.client_id=client.id ', ' _type ' = ' right ', ' user ' = = Array (' UserName ', ' _on ' = ' order.user_id= ') User.ID '),);}? >


Table structure









After executing the following statement, print out a blank
$Model = D ("Orderview"), $result = $Model->select ();p($result);d ie;


After viewing the log file, the resulting SQL statement is


Please the great God to help you. This is a final design experiment, there will be a few days to hand in, extremely urgent, thank you!


Reply to discussion (solution)

An automatic table prefix has been added to the config file

What is wrong with the generated SQL statement execution?

What is wrong with the generated SQL statement execution?


Error message
1064:you has an error in your SQL syntax; Check the manual that corresponds to your MySQL server version for the right syntax to use near ' left JOIN or_client clien T on order.client_id=client.id right JOIN or_user user ' in line 1

Table aliases do not use order,
Order is a keyword ~

Table aliases do not use order,
Order is a keyword ~


As you said, it was a real success, thanks so much.
  • 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.