2010-12-22 79 views
0

我想通過php輸入註冊信息到mysql數據庫,但sql語句似乎是錯誤的。任何人都可以告訴我我做錯了什麼?無法找出sql語法錯誤

INSERT INTO user(id,username,password,email,security_question,security_answer,face_photo,body_photo,user_salutation,user_firstname,user_middlename,user_lastname,parent_salutation,parent_firstname,parent_middlename,parent_lastname,gender,date_of_birth,address1,address2,country,state,city,pincode,country_code1,area_code1,phone1,country_code2,area_code2,phone2,alt_email,website,travel_within,passport,travel_companion,formal_education,other_qualification,known_languages,hobbies,about_you) VALUES('',some username,abcabc,[email protected],What is your first pet\'s name?,I don\'t know,'','',Mr.,sam,,fisher,Mr.,,,,Male,05/12/2009,test address1,,10,1073,16713,000000,00,00,00000000,,,,[email protected],[email protected],Within Country,on,on,none,none,spanish,none,none) 
+0

下一次請添加一些換行符代碼。將所有內容放在一個大單行中會使事情變得非常難以閱讀 – 2010-12-22 10:32:03

回答

3

您沒有任何周圍的字符串值的引號:

.....) VALUES('', 'some username', 'abcabc', '[email protected]'..... etc... 
+0

謝謝你的工作。有沒有什麼好的教程,其中包含編寫查詢以將$ _Post vars從php存儲到mysql的所有基本規則?就像什麼時候使用反引號和單引號一樣,以及如何使用函數get_magic_quotes_gpc()來安全編寫代碼 – Bluemagica 2010-12-22 10:41:52