加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

thinkphp视图模型查询提示ERR: 1146:Table 'db.pr_order_vie

发布时间:2020-12-13 02:06:31 所属栏目:PHP教程 来源:网络整理
导读:《PHP实例:thinkphp视图模型查询提示ERR: 1146:Table 'db.pr_order_view' doesn't exist的解决方法》要点: 本文介绍了PHP实例:thinkphp视图模型查询提示ERR: 1146:Table 'db.pr_order_view' doesn't exist的解决方法,希望对您有用。如果有疑问,可以联系

《PHP实例:thinkphp视图模型查询提示ERR: 1146:Table 'db.pr_order_view' doesn't exist的解决方法》要点:
本文介绍了PHP实例:thinkphp视图模型查询提示ERR: 1146:Table 'db.pr_order_view' doesn't exist的解决方法,希望对您有用。如果有疑问,可以联系我们。

PHP编程本篇章节讲解thinkphp视图模型查询失败提示:ERR: 1146:Table 'db.pr_order_view' doesn't exist解决方法.分享给大家供大家参考.具体方法如下:

PHP编程一、问题描述:

PHP编程想用thinkphp的视图模型进行关联查询,结果出现了这样的问题(log日志记录):ERR: 1146:Table 'db.pr_order_view' doesn't exist,我就纳闷,视图模型怎么出来的sql是这样的呢,视图模型如下:

代码如下:
class OrderViewModel extends ViewModel
{
public $viewFields = array(
'Order' =>array(
'_as'=>'Orders',//重新命名,以免与系统语法冲突
'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'
),
);
}
?>

PHP编程二、解决办法:

PHP编程看了手册及百度了很多,没有找到办理方案,调用也没有错$Form = D('Admin/OrderView');(这里我用了分组)经过我自己查看,原来是有问题的,原来视图模型的名字命名错了,OrderView.class.php,正常应该是 OrderViewModel.class.php.

PHP编程对于ThinkPHP初学者来说尤其要注意不要犯这样的低级错误!

PHP编程希望本文所述对大家的ThinkPHP框架程序设计有所赞助.

欢迎参与《PHP实例:thinkphp视图模型查询提示ERR: 1146:Table 'db.pr_order_view' doesn't exist的解决方法》讨论,分享您的想法,编程之家 52php.cn为您提供专业教程。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读