我正在尝试使用 insert 将数据插入表中。
INSERT INTO tbl_products (user_id,productkey,listitemname,itemdescription
,thumbnail,rollover,itemfile,themepreview1,themepreview2,themepreview3
,themepreview4,categoryname,sub_category_id,browsercompatiable,filesinclude
,noofcolumns,layout,demourl,itemtags,create_date,update_date,license_number)
VALUES (117,'395cb2e171ac','Baby','This is baby'
,'a4fb673be7b5','d6232cad4955','e3fe02d02c82','dc7067dffd0a','72f48e9a9585'
,'35b016bf135c','6e36d212f3c0','9',51,'ie8,','ie8,',1,1,'http://asdsaf.com'
,'rwreewr','2012-06-30','2012-06-30','1565-5827-7289-918')
但是没有插入数据,MySQL 显示以下错误:
1452 - 无法添加或更新子行:外键约束失败(
wwwwdmar_orangedoor
.tbl_products
, CONSTRAINTtbl_products_ibfk_1
FOREIGN KEY (categoryname
) REFERENCEStbl_sub_categories
(sub_category_id
) ON DELETE CASCADE ON UPDATE CASCADE)