php技术博客
让天下没有搞不定的bug~

thinkphp的视图模型出现check the manual that corresponds to your MySQL server version for the right syntax错误

thinkphp的视图模型出现check the manual that corresponds to your MySQL server version for the right syntax错误

在运用thinkphp视图模型关联数据表查询的时候,总是出现空白,我打印了一下sql语句然后到数据库里执行,然后就报了这个错误:check the manual that corresponds to your MySQL server version for the right syntax

经过仔细排查,发现发现是SQL关键字冲突。原因是因为我的数据表中有一个订单表order与sql语句冲突,然后小涛就想办法,视图模型可不可以吧数据表重新命名呢,经过一系列的搜寻,终于找到,具体代码如下:
[warning]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’,
),[/warning]

这样在运行的话,就没有上面的错误了,这个问题纠结了半天,终于搞定啦。

赞(0)
未经允许不得转载:PHP技术博客 » thinkphp的视图模型出现check the manual that corresponds to your MySQL server version for the right syntax错误