[英]MySQL query works fine on local server but gives error in live
I have just done my site live.我刚刚完成了我的网站。 Below is the simple query;
下面是简单的查询; it works fine on my localhost but not on the live server.
它在我的本地主机上运行良好,但在实时服务器上运行不正常。
select * from friends where action='chating'
It gives error "you have to use right syntax near where".它给出错误“你必须在附近使用正确的语法”。
Please help me: why this happening, and how do I solve it?请帮助我:为什么会这样,我该如何解决?
I guess your mysql version is different on local and live.我猜你的 mysql 版本在本地和现场是不同的。 Please check it.
请检查一下。
I am sure it's Mysql5.5
on live in which ACTION
is new Reserved Keyword .我确定它是
Mysql5.5
on live,其中ACTION
是新的Reserved Keyword 。 SO while if you using it as column name then you need to use bacticks(`) around it while using in query.因此,如果您将它用作列名,则在查询中使用时需要在其周围使用bacticks(`) 。
Try below:尝试以下:
select * from friends where `action`='chating'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.