好的,所以我不明白最近发生了什么。据我所知,代码是正确的,但它抛出一个奇怪的SQL语法错误,因为我在我的网站上使用相同的代码。我希望有人可以查看它,如果他们看到任何错误,请告诉我。谢谢。
错误: 您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以便在第1行的“WHERE id = 954001”附近使用正确的语法
守则:
<?php session_start(); //!!!!Nothing Can Go Before Me!!!!
require_once('***********');
$id = $_SESSION['id'];
//INFO UPDATE//
$her_name = $_POST['her_name'];
$her_pic_url = $_POST['her_pic_url'];
$his_name = $_POST['his_name'];
$his_pic_url = $_POST['his_pic_url'];
$event_date = $_POST['event_date'];
$time = $_POST['time'];
$event_address = $_POST['event_address'];
$email = $_POST['email'];
$her_about = $_POST['her_about'];
$her_fb = $_POST['her_fb'];
$her_twit = $_POST['her_twit'];
$him_about = $_POST['him_about'];
$him_fb = $_POST['him_fb'];
$him_twit = $_POST['him_twit'];
$userpic_1 = $_POST['userpic_1'];
$usercap_1 = $_POST['usercap_1'];
$userpic_2 = $_POST['userpic_2'];
$usercap_2 = $_POST['usercap_2'];
$userpic_3 = $_POST['userpic_3'];
$usercap_3 = $_POST['usercap_3'];
$userpic_4 = $_POST['userpic_4'];
$usercap_4 = $_POST['usercap_4'];
$userpic_5 = $_POST['userpic_5'];
$usercap_5 = $_POST['usercap_5'];
$userpic_6 = $_POST['userpic_6'];
$usercap_6 = $_POST['usercap_6'];
$userpic_7 = $_POST['userpic_7'];
$usercap_7 = $_POST['usercap_7'];
$userpic_8 = $_POST['userpic_8'];
$usercap_8 = $_POST['usercap_8'];
$userpic_9 = $_POST['userpic_9'];
$usercap_9 = $_POST['usercap_9'];
$userpic_10 = $_POST['userpic_10'];
$usercap_10 = $_POST['usercap_10'];
$userpic_11 = $_POST['userpic_11'];
$usercap_11 = $_POST['usercap_11'];
$userpic_12 = $_POST['userpic_12'];
$usercap_12 = $_POST['usercap_12'];
$userpic_13 = $_POST['userpic_13'];
$usercap_13 = $_POST['usercap_13'];
$userpic_14 = $_POST['userpic_14'];
$usercap_14 = $_POST['usercap_14'];
$userpic_15 = $_POST['userpic_15'];
$usercap_15 = $_POST['usercap_15'];
$userpic_16 = $_POST['userpic_16'];
$usercap_16 = $_POST['usercap_16'];
$userpic_17 = $_POST['userpic_17'];
$usercap_17 = $_POST['usercap_17'];
$userpic_18 = $_POST['userpic_18'];
$usercap_18 = $_POST['usercap_18'];
$userpic_19 = $_POST['userpic_19'];
$usercap_19 = $_POST['usercap_19'];
$userpic_20 = $_POST['userpic_20'];
$usercap_20 = $_POST['usercap_20'];
$userpic_21 = $_POST['userpic_21'];
$usercap_21 = $_POST['usercap_21'];
$userpic_22 = $_POST['userpic_22'];
$usercap_22 = $_POST['usercap_22'];
$userpic_23 = $_POST['userpic_23'];
$usercap_23 = $_POST['usercap_23'];
$userpic_24 = $_POST['userpic_24'];
$usercap_24 = $_POST['usercap_24'];
$userpic_25 = $_POST['userpic_25'];
$usercap_25 = $_POST['usercap_25'];
$insert = "UPDATE ******* SET her_name = '$_POST[her_name]', her_pic_url = '$_POST[her_pic_url]', his_name = '$_POST[his_name]', his_pic_url = '$_POST[his_pic_url]', event_date = '$_POST[event_date]', time = '$_POST[time]', event_address = '$_POST[event_address]', email = '$_POST[email]', her_about = '$_POST[her_about]', her_fb = '$_POST[her_fb]', her_twit = '$_POST[her_twit]', him_about = '$_POST[him_about]', him_fb = '$_POST[him_fb]', him_twit = '$_POST[him_twit]', userpic_1 = '$_POST[userpic_1]', usercap_1 = '$_POST[usercap_1]', userpic_2 = '$_POST[userpic_2]', usercap_2 = '$_POST[usercap_2]', userpic_3 = '$_POST[userpic_3]', usercap_3 = '$_POST[usercap_3]', userpic_4 = '$_POST[userpic_4]', usercap_4 = '$_POST[usercap_4]', userpic_5 = '$_POST[userpic_5]', usercap_5 = '$_POST[usercap_5]', userpic_6 = '$_POST[userpic_6]', usercap_6 = '$_POST[usercap_6]', userpic_7 = '$_POST[userpic_7]', usercap_7 = '$_POST[usercap_7]', userpic_8 = '$_POST[userpic_8]', usercap_8 = '$_POST[usercap_8]', userpic_9 = '$_POST[userpic_9]', usercap_9 = '$_POST[usercap_9]', userpic_10 = '$_POST[userpic_10]', usercap_10 = '$_POST[usercap_10]', userpic_11 = '$_POST[userpic_11]', usercap_11 = '$_POST[usercap_11]', userpic_12 = '$_POST[userpic_12]', usercap_12 = '$_POST[usercap_12]', userpic_13 = '$_POST[userpic_13]', usercap_13 = '$_POST[usercap_13]', userpic_14 = '$_POST[userpic_14]', usercap_14 = '$_POST[usercap_14]', userpic_15 = '$_POST[userpic_15]', usercap_15 = '$_POST[usercap_15]', userpic_16 = '$_POST[userpic_16]', usercap_16 = '$_POST[usercap_16]', userpic_17 = '$_POST[userpic_17]', usercap_17 = '$_POST[usercap_17]', userpic_18 = '$_POST[userpic_18]', usercap_18 = '$_POST[usercap_18]', userpic_19 = '$_POST[userpic_19]', usercap_19 = '$_POST[usercap_19]', userpic_20 = '$_POST[userpic_20]', usercap_20 = '$_POST[usercap_20]', userpic_21 = '$_POST[userpic_21]', usercap_21 = '$_POST[usercap_21]', userpic_22 = '$_POST[userpic_22]', usercap_22 = '$_POST[usercap_22]', userpic_23 = '$_POST[userpic_23]', usercap_23 = '$_POST[usercap_23]', userpic_24 = '$_POST[userpic_24]', usercap_24 = '$_POST[usercap_24]', userpic_25 = '$_POST[userpic_25]', usercap_25 = '$_POST[usercap_25]', WHERE id=$id";
$result=mysql_query($insert) or die(mysql_error());
if ($result) {
header("location:**********");
}
else {
echo "Whoops! There seems to have been an error! Please try again! If the problem persists please contact Modern Event Productions to update your event!<a href='***************'>Click here to go back to the Vendor System and try again.</a>";
} ?>
答案 0 :(得分:2)
set子句中的最后一个元素包含一个位于WHERE
之前的尾随逗号。
在WHERE
子句之前删除该逗号','应该清除错误。
答案 1 :(得分:0)
,WHERE id=$id
它告诉您SQL语句不正确,问题是语句的WHERE
子句。
摆脱,