This example describes the Thinkphp view model query failure prompt: Err:1146:table ' db.pr_order_view ' doesn ' t exist solution. Share to everyone for your reference. The specific methods are as follows:
First, the problem description:
To associate a query with a thinkphp view model, the result is this (log logging): err:1146:table ' db.pr_order_view ' doesn ' t exist, I wonder how the view model comes out of SQL, The view model is as follows:
Copy Code code as follows:
Class Orderviewmodel extends ViewModel
{
Public $viewFields = Array (
' Order ' =>array (
' _as ' => ' Orders ',//renamed to avoid conflict with system syntax
' ID ' => ' oid ',
' Ordid ',
' User ',
' Product ',
' Status ',
' Paynum ',
' Cat ',
' Payment_trade_no ',
' IP ' => ' MIP ',
' Reserve_time ',
' Createtime ',
' Payment_trade_status ',
),
' Member ' =>array (
' ID ' => ' mid ',
' Name ' => ' uname ',
' Cardnum ',
' Tel ',
' Reg_time ',
' Reg_ip ',
' QQ ',
' Email ',
' Address ',
' Last_login_time ',
' Last_login_ip ',
' _on ' => ' orders.user=member.id '
),
' Product ' =>array (
' ID ',
' Shorttitle ',
' Img1 ',
' Category ',
' _on ' => ' orders.product=product.id '
),
);
}
?>
Second, the solution:
Read the manual and Baidu a lot, did not find a solution, the call is not wrong $form = D (' Admin/orderview '); (Here I use a group) after my own view, there is a problem, the original view model name is wrong, OrderView.class.php, normal should be OrderViewModel.class.php.
For thinkphp beginners, pay special attention not to make such a low-level mistake!
I hope this article will be helpful to everyone's thinkphp framework program design.