Thinkphp view model query prompt ERR: 1146: Table 'db. pr_order_view 'doesn' texist solution _ php instance

Source: Internet
Author: User
This article mainly introduces the thinkphp view model query prompt ERR: 1146: Tabledb. the pr_order_viewdoesntexist solution can be used as a reference for beginners of ThinkPHP. If you need it, refer to the following example to describe the thinkphp view model query failure prompt: ERR: 1146: Table 'db. pr_order_view 'doesn' t exist solution. Share it with you for your reference. The specific method is as follows:

I. Problem description:

If you want to use the view model of thinkphp for associated queries, the following error occurs: ERR: 1146: Table 'db. pr_order_view 'doesn' t exist. I am wondering how the SQL statements of the view model come out. The view model is as follows:

The Code is as follows:

Class OrderViewModel extends ViewModel
{
Public $ viewFields = array (
'Order' => array (
'_ As' => 'Orders', // Rename to avoid conflicts with the system syntax.
'Id' => 'id ',
'Ordid ',
'User ',
'Product ',
'Status ',
'Paynum ',
'Cat ',
'Payment _ trade_no ',
'IP' => 'mip ',
'Reserve _ time ',
'Createtime ',
'Payment _ trade_status ',
),
'Member' => array (
'Id' => 'mid ',
'Name' => 'uname ',
'Cardnnum ',
'Tel ',
'Reg _ time ',
'Reg _ ip ',
'Qq ',
'Email ',
'Address ',
'Last _ login_time ',
'Last _ login_ip ',
'_ On' => 'Orders. user = Member. id'
),
'Product' => array (
'Id ',
'Your title ',
'Img1 ',
'Category ',
'_ On' => 'Orders. product = Product. id'
),
);
}
?>

Ii. solution:

I have read many manuals and Baidu, but I have not found a solution, and the call is not wrong. $ Form = D ('admin/orderview'); (I used groups here) after checking it myself, it turns out that there is a problem. The original view model name is wrong, OrderView. class. php. It should be OrderViewModel. class. php.

For beginners of ThinkPHP, pay special attention not to make such low-level mistakes!

I hope this article will help you with ThinkPHP framework programming.

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.