-2

这是查询:

UPDATE clubs WHERE clubId = $clubId SET (name='$name', category = '$category', 'description' = '$description', president = '$president', email = '$email', phone = $phone', treasurer = $treasurer', treasurerEmail = $treasurerEmail',treasurerPhone = $treasurerPhone', advisor = '$advisor', advisorEmail = '$advisorEmail', projectCode = '$projectCode', rollover = $rollover)"

当我尝试运行它时出现此错误:更新俱乐部时发生错误。”}您的 SQL 语法有错误;请查看与您的 MySQL 服务器版本相对应的手册,以获取在 'WHERE clubId = 附近使用的正确语法1 SET (name='Radio', category = 'Media', 'descri' at line 1

有任何想法吗?

4

2 回答 2

2

使用这个:

UPDATE clubs SET name = '$name', category = '$category', description = '$description', president = '$president', email = '$email', phone = '$phone', treasurer = '$treasurer', treasurerEmail = '$treasurerEmail', treasurerPhone = '$treasurerPhone', advisor = '$advisor', advisorEmail = '$advisorEmail', projectCode = '$projectCode', rollover = '$rollover' WHERE clubId = '$clubId'

你也有一堆不合适'的地方。

为popnoodles编辑了sql。

UPDATE clubs SET
name = '$name',
category = '$category',
description = '$description',
president = '$president',
email = '$email',
phone = '$phone',
treasurer = '$treasurer',
treasurerEmail = '$treasurerEmail',
treasurerPhone = '$treasurerPhone',
advisor = '$advisor',
advisorEmail = '$advisorEmail',
projectCode = '$projectCode',
rollover = '$rollover'
WHERE clubId = '$clubId'
于 2013-10-30T20:54:01.723 回答
1

你需要放在WHERE语句的末尾

UPDATE clubs SET name='$name', category = '$category', 'description' = '$description', president = '$president', email = '$email', phone = $phone', treasurer = $treasurer', treasurerEmail = $treasurerEmail',treasurerPhone = $treasurerPhone', advisor = '$advisor', advisorEmail = '$advisorEmail', projectCode = '$projectCode', rollover = $rollover WHERE clubId = $clubId 
于 2013-10-30T20:49:50.457 回答