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.