thinkphp View model query hints err:1146:table ' db.pr_order_view ' doesn ' t exist solution _php instance

Source: Internet
Author: User

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.

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.