0
出於某種原因,我的代碼給了我一個錯誤,我不明白爲什麼。這裏的錯誤:錯誤的MySQL語法?
INSERT INTO organization (org_name, add_1, add_2, city, state, zip, url, email, phone, contact, hours, file_loc, notes, description, group) VALUES('testmi', '333', '', '', 'MI', '', 'www.blah.com', '', '888-999-2222', '', '', '', '', '', 'Michigan')QUERROR 3You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group) VALUES('testmi', '333', '', '', 'MI', '', 'www.blah.com', ''' at line 1
而這裏的代碼:
$sqlInsertOrg = "INSERT INTO organization (org_name, add_1, add_2, city, state, zip, url, email, phone, contact, hours, file_loc, notes, description, group)
VALUES('".$org_name."', '".$add_1."', '".$add_2."', '".$city."', '".$state."', '".$zip."', '".$url."', '".$email."', '".$phone."', '".$contact."', '".$hours."', '".$file_loc."', '".$notes."', '".$description."', '".$group."')";
試着把你的變量沒有「。$ var」。只需做「$ var」,將所有內容保存在一行中,只是爲了提高可讀性。 – 2012-01-18 17:53:56