【发布时间】:2015-10-30 13:50:38
【问题描述】:
我在使用where 子句插入数据时遇到问题。这是查询:
$hi= "INSERT INTO user_detail (email, looking, username, profession, experience,
current_work, state, job_type, about, college, diploma, department)
VALUES ('$email', '$looking', '$username', '$profession','$experience',
'$current_work', '$state', '$job_type', '$about', '$college', '$diploma', '$department')
WHERE s='$username'";
它显示了错误:
您的 SQL 语法有错误;检查手册 对应于您的 MySQL 服务器版本,以便使用正确的语法 在第 1 行的 'WHERE s='aniket276'' 附近
【问题讨论】:
-
为什么在 INSERT 期间使用 WHERE ?如果您的线路已经存在,请改用 UPDATA。
-
会更新工作吗?查询会是什么样子@Nirnae
-
插入查询的语法是
INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...)不要在里面使用where子句 -
您是要在表中插入新行,还是要更新已经存在的行?