语法错误使用PHP :: PDO保存到INT字段 [英] Incorrect Syntax Saving to an INT field using PHP::PDO

查看:41
本文介绍了语法错误使用PHP :: PDO保存到INT字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



过去24小时我一直在与一个问题作斗争。



每当我尝试保存到int字段时。



这就是我所做的:



< br /> 
$ query =更新评论设置comment_authorized = 1其中id = 4;< br />
$ result = $ pdo-> prepare($查询);< br />
$ result-> execute();< br />





这个是我得到的错误:

 SQLSTATE [42000]:语法错误或访问冲突:1064您的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,以便在设置comment_authorized = 1在哪里(id = 4)第1行附近使用正确的语法





这种方法在插入非INT列时效果很好。我只是不知道为什么这不起作用。



我调试了这个并且无法弄明白。总而言之,这是一个非常简单的基本陈述。



请帮助。

解决方案

query = 更新评论设置comment_authorized = 1其中id = 4;< br />


result =


pdo-> prepare(

Hello Everyone,

I have been battling with an issue for the past 24 hours.

Whenever I try to save into an int field.

This is what I did:

<br />
$query = "Update comments Set comment_authorized = 1 Where id = 4";<br />
$result = $pdo->prepare($query);<br />
$result->execute();<br />



This is the error I get:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Set comment_authorized = 1 Where (id = 4)' at line 1



This same approach works well when inserting into non-INT columns. I just don't know why this is not working.

I have debugged this and couldn't just figure it out. After-all, this is a very simple basic statement.

Please help.

解决方案

query = "Update comments Set comment_authorized = 1 Where id = 4";<br />


result =


pdo->prepare(


这篇关于语法错误使用PHP :: PDO保存到INT字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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