mysql更新单元格内容问题
我正在尝试更新数据库中的值,但收到以下错误:
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 ''users' ('new_user') VALUES ('1') WHERE 'id'= 5' at line 1
我正在尝试更新“new_user”列中的表“users”,其中 id 等于 $userid。但这不起作用。请帮忙。
$newuservalue = '1';
$notnewuser ="UPDATE 'users' ('new_user') VALUES ('$newuservalue') WHERE 'id'= $userid ";
$query2 = mysql_query($notnewuser) or die(mysql_error());
I am trying to update a value in my database but am recieving the following error:
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 ''users' ('new_user') VALUES ('1') WHERE 'id'= 5' at line 1
I am trying to UPDATE the table 'users' in the column 'new_user' where the id is equal to $userid. But it don't work. Please help.
$newuservalue = '1';
$notnewuser ="UPDATE 'users' ('new_user') VALUES ('$newuservalue') WHERE 'id'= $userid ";
$query2 = mysql_query($notnewuser) or die(mysql_error());
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
嗯,你的语法是错误的。
它应该是:
因此,删除查询的“值”部分并放入“设置”部分。
这是官方文档的链接。
Well, your syntax is wrong.
It should be:
So, remove the "values" part of your query and put in the "set" part.
Here's a link to the official documentation.
我有时会遇到这个问题,这就是插入新行的代码:d
它应该是:
您也不需要在列名周围加上引号,这也可能会带来一些问题。
i have that problems some times, that's the code to insert a new row :d
It should be:
you also don't need to put quotes around your column names, that might give some problems as well.