【发布时间】:2013-08-09 23:09:09
【问题描述】:
这是我遇到的一个奇怪问题。我正在尝试通过用逗号连接新旧值来用新值更新数据库表中的值。所以基本上我现在的价值是: 你好,我正在将其更新为 World,我希望新值是 Hello,world,但我无法做到这一点。 CONCAT 和 CONCAT_WS 都通过错误语法来运行。
表名是字段。我希望更新的列是值,要连接的新值是 $newval。这是我的查询。
$sql="update fields set values=CONCAT_WS(',',values, '$newval') where name='fundType'";
我收到此错误:
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 'values=CONCAT_WS(',',values, 'Buyout') where name='fundType'' at line 1
任何帮助将不胜感激。 艾哈迈尔 A.
【问题讨论】: