使用Where子句插入 [英] Insert using Where clause
本文介绍了使用Where子句插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在使用where
子句插入数据时遇到问题.这是查询:
I am having problem with inserting data with where
clause. Here is the query:
$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"附近
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 'WHERE s='aniket276'' at line 1
推荐答案
使用MySQL更新
那样:-
UPDATE user_detail SET email='$email' WHERE s='$username';
如果您想更改的值,则应该使用UPDATE. 使用WHERE子句选择的记录中的字段
You should rather use UPDATE, if you want to change the value of the field in records you select using the WHERE clause
这篇关于使用Where子句插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文