【发布时间】:2018-09-12 08:40:36
【问题描述】:
您好现在已经研究了一段时间,但似乎无法弄清楚为什么它不会更新。 我已经写了语句,但是当它运行时它根本不会更新记录,但我看不出有什么问题。
$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
已经尝试更新命令得到同样的问题
$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 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
【问题讨论】:
-
INSERT 没有 WHERE 子句。 (新行插入到表中。)使用 UPDATE 更新行的列。
-
您要插入或更新什么?您为插入而不是更新编写的查询
标签: php sql phpmyadmin dreamweaver