2013-02-06 5 views
0

누구에게 문제가 있는지 알 수 있습니까? 그것은 정말로 쉼표 또는 철자법 실수 일 것임에 틀림 없다. 그러나 나는이 5 개의 줄을 2 시간보고 있고, 아직도 누군가 그것을 볼 수있는 것을 볼 수 없다. 그것은 매우 빨리 볼 수있다.SQL 쿼리가 작동하지 않습니다.

오류 SQL 쿼리 :

INSERT INTO SalesOrder 
(

Customer, ContactName, Phone, Email, BillingAddress1, BillingAddress2, BillingCity, BillingState, BillingCountry, BillingPostalCode, BillingAddressRemarks, ShipToCompanyName, ShippingAddress1, ShippingAddress2, ShippingCity, ShippingState, ShippingCountry, ShippingPostalCode, ShippingAddressRemarks, CurrencyCode, ExchangeRate, PricingScheme, PaymentTerms, TaxingScheme, Tax1Rate, Tax2Rate, CalculateTax2OnTax1, Tax1Name, Tax2Name, TaxOnShipping, Custom1, Custom2, Custom3, ItemName, ItemDescription, ItemQuantity, ItemQuantityUoM, ItemUnitPrice, ItemDiscount, ItemSubtotal, ItemTaxCode 
) VALUES (
'Yu', 'Yau ', '01224 580318', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'GBP', '1', '', '', '', 0, 0, 'FALSE', '', '', 'FALSE', '', '', '', 'Vg0003', 'Apple Green', 2, 'box', '15.5', '0%'; 

MySQL said: 

#1064 - 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 'Customer,ContactName,Phone,Email,BillingAddress1,BillingAddress2,BillingCity,Bil' at line 1 

답변

5

이 닫는 괄호를 누락 : 당신이 값 뒤에 브래킷을 닫는 놓친 아마 때문에

VALUES (...) ; 
      ^^^ 
+0

lolz, 독수리 눈 여기 이상 ^^ – Hituptony

+0

당신이 옳았 으면 좋겠지 만, 41 개의 값을 넣고 41 개의 테이블 필드 컬럼은 – user1508136

+0

으로 이름이 바뀌었다. – user1508136

1

. 적절하게 형식이어야합니다.

$sql = mysql_query("INSERT INTO table() VALUES()"); 
0

이 코멘트는 답변 상자에 들어 있으므로 잘 표시됩니다. 다른 두 가지 대답은 정확합니다.

insert into yourtable 
(f1 
, f2 
, f3 
-- etc 
, f10 
) 
values 
(v1 
, v2 
, v3 
-- etc 
, v10 
) 

그것은 눈에 보이는 모든 브래킷을 유지 :이 같은 쿼리를 입력하면 이와 같은

문제가 적게 발생합니다. 당신은 여분의 쉼표를 가질 가능성이 적습니다. 또한 쿼리를 개발할 때 문제가 발생할 경우 필드와 값 집합을 주석으로 처리하는 것이 더 쉽습니다.

관련 문제