Zend MySqli PHP错误 [英] Zend MySqli php error

查看:74
本文介绍了Zend MySqli PHP错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我附加了一个Sql语句,通过控制面板phpMyAdmin运行了它,它起作用了,但是一旦我将其放回php页面,它就会抛出此错误,

Hi I have a Sql statement that I appended , ran it through Control Panel phpMyAdmin, it worked but as soon as I placed it back in my php page, it throws me this error,

'Zend_Db_Statement_Mysqli_Exception' with message 'Mysqli prepare error: You have an error in your SQL syntax;



这是我的sql



here is my sql

SELECT
               s.id,
   s.groupId,
               s.name,
               s.managerId,
               s.paymentType,
               s.mustHave,
               s.deleted
           FROM
               dealer_stores s
           INNER JOIN
               users u
           ON
               u.dealerStoreId = s.id
           WHERE userType = 'Rep'

推荐答案

基于SQL,很快想到的唯一事情是没有为列userType定义别名.可能是两个表都具有此列,所以SQL可能会模棱两可.所以也许像这样:
Based on the SQL the only thing that quickly comes in mind is that no alias is defined for column userType. Could it be that both tables have this column so the SQL would be ambiguous. So perhaps something like:
SELECT
 s.id,
 s.groupId,
 s.name,
 s.managerId,
 s.paymentType,
 s.mustHave,
 s.deleted
FROM
   dealer_stores s
 INNER JOIN
   users u
 ON
   u.dealerStoreId = s.id
WHERE u.userType = 'Rep'


同样,如果您通过代码进行调试,则是所使用的确切语句还是将附加到SQL字符串的语句.


Also if you debug through the code, is that the exact statement that is used or is something appended to the SQL string.


这篇关于Zend MySqli PHP错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆