下面是my表的架构(name->add_to_cart);
add_to_cart_id int(10) PK
created_date timestamp
ip_address varchar(17)
customer_id int(11)
session_id varchar(1024)
brand_id int(11)
product_id int(11)
sales_event_id int(11)
quantity int(11)
referer varchar(1024)
user_agent varchar(1024)但是,每当我试图执行以下查询时
INSERT INTO `add_to_cart` (add_to_cart_id,created_date,ip_address,customer_id,session_id,sku_id,product_id,sales_event_id,quantity,referer,user_agent) VALUES (1,2011-02-24 20:40:34,66.65.135.89,70154,qbk5r0rg9sl2ndiimquvnsab46,83791,308933,10105,2,https://www.onekingslane.com/product/10105/308933,Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-us) AppleWebKit/533.19.4 (KHTML);我得到以下错误
qbk5r0rg9sl2ndiimquvnsab46,83791,308933,10105,2,错误1064 (42000):您的SQL语法有错误;请检查与MySQL服务器版本相对应的手册,以获得在“20:40:34:66.65.135.89,70154”附近使用的正确语法,在第1行
http‘错误1064 (42000):您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以确定在第1行使用“U”的正确语法--错误1064 (42000):您的SQL语法有错误;检查与您的MySQL服务器版本对应的手册,以获得在第1行错误1064 (42000)处使用“Intel 10_6_5”附近的正确语法:您的MySQL语法中有一个错误;检查与您的MySQL服务器版本对应的手册,以获得在第1行“en-us”AppleWebKit/533.19.4 (KHTML)附近使用的正确语法。
我做错什么了。谢谢。
发布于 2011-09-14 21:55:40
您需要引用字符串值。
INSERT INTO `add_to_cart`
(
add_to_cart_id,
created_date,
ip_address,
customer_id,
session_id,
sku_id,
product_id,
sales_event_id,
quantity,
referer,
user_agent
)
VALUES
(
1,
'2011-02-24 20:40:34',
'66.65.135.89',
70154,
'qbk5r0rg9sl2ndiimquvnsab46',
83791,
308933,
10105,
2,
'https://www.onekingslane.com/product/10105/308933,Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-us) AppleWebKit/533.19.4 (KHTML);'
)https://stackoverflow.com/questions/7423431
复制相似问题