SQL update语句未在phpmyadmin记录上更新
Hi已经在这方面工作了一段时间,但似乎不明白为什么它不会更新。 我已经写了这个语句,但是当它运行时,它根本不会更新记录,但是我看不出哪里出了问题SQL update语句未在phpmyadmin记录上更新,php,sql,phpmyadmin,dreamweaver,Php,Sql,Phpmyadmin,Dreamweaver,Hi已经在这方面工作了一段时间,但似乎不明白为什么它不会更新。 我已经写了这个语句,但是当它运行时,它根本不会更新记录,但是我看不出哪里出了问题 $query = ("INSERT INTO tbldvd(Title, Certificate, Director, Genre, Synopsis, RentalAmount, BeingRented) VALUES('$Title','$Certification','$Director','$Genre','$Synopsis','$Price
$query = ("INSERT INTO tbldvd(Title, Certificate, Director, Genre, Synopsis, RentalAmount, BeingRented) VALUES('$Title','$Certification','$Director','$Genre','$Synopsis','$Price','$Rented') WHERE DVDID= ".$ID."");
是我的查询,运行该查询时我会得到错误
ERROR 404: Could not able to execute INSERT INTO tbldvd(Title, Certificate, Director, Genre, Synopsis, RentalAmount, BeingRented) VALUES ('Secret Life Of Walter Mitty','18','Ben Stiller','Family','Day Dreamer','5.00','No') WHERE DVDID= 3 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 DVDID= 3' at line 1
ERROR 404: Could not able to execute 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 '[Secret Life Of Walter Mitty],Certificate=[18],Director=[Ben Stiller],`Genre' at line 1
已尝试使用update命令来获得相同的问题
$query = mysqli_query($con, "UPDATE tbldvd SET Title=[$Title],Certificate=[$Certification],Director=[$Director],Genre=[$Genre],Synopsis=[$Synopsis],RentalAmount=[$Price],BeingRented=[$Rented] WHERE DVDID = $ID");
我从哪里得到的错误
ERROR 404: Could not able to execute INSERT INTO tbldvd(Title, Certificate, Director, Genre, Synopsis, RentalAmount, BeingRented) VALUES ('Secret Life Of Walter Mitty','18','Ben Stiller','Family','Day Dreamer','5.00','No') WHERE DVDID= 3 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 DVDID= 3' at line 1
ERROR 404: Could not able to execute 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 '[Secret Life Of Walter Mitty],Certificate=[18],Director=[Ben Stiller],`Genre' at line 1
您必须使用
UPDATE
语法。请参见插入没有WHERE子句。(新行插入到表中。)使用UPDATE更新行的列。要插入或更新什么?您为insert而不是UPDATEARLEADY编写的查询尝试使用update命令获取相同的问题$query=mysqli_query($con),“更新tbldvd
Title=[$Title],证书
=[$Certification],导演
=[$Director],流派
=[$Genre],大纲
=[$Synopsis],RentalAmount
=[$Price],BeingRented
=[$Rented],其中DVDID=$ID”);在那里我得到了错误404:无法执行您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以了解在第行的“[沃尔特·米蒂的秘密生活],证书
=[18],导演
=[Ben Stiller],“流派”附近使用的正确语法1@Ollie,将该评论复制到您的问题中!(注意缺少单引号…比较插入和更新尝试…)