cancel
Showing results for 
Search instead for 
Did you mean: 

Error on Insert Product Data via MYSQL

SOLVED

Error on Insert Product Data via MYSQL

Hi there,

 

i want to insert the plu data to database, and i already find out the attribute_id is 166, and i try to insert the data via this query but i got an error

 

insert into catalog_product_entity_varchar(value_id, attribute_id, store_id, entity_id, value) values( "0", "166", "0", "2", "u187")

 

#1452 - Cannot add or update a child row: a foreign key constraint fails (`m2`.`catalog_product_entity_varchar`, CONSTRAINT `CAT_PRD_ENTT_VCHR_ATTR_ID_EAV_ATTR_ATTR_ID` FOREIGN KEY (`attribute_id`) REFERENCES `eav_attribute` (`attribute_id`) ON DELETE CASCADE)

 

how can i solve this problem and continue the insert? thank you

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Error on Insert Product Data via MYSQL

Hi @AliveHealth

 

This error come due to FOREIGN KEY CONSTRAINT define for parent and child relational table and the attribute_id is not available in parent table so that you can't insert in child table.. Please check parent table and re-verify the attribute_id.

 

Let me know if it helps.

Let me know if it helps. You can raise a KUDOS if its really worth for you. Also if it solves your problem then please mark as SOLUTION.

View solution in original post

2 REPLIES 2

Re: Error on Insert Product Data via MYSQL

Hi @AliveHealth

 

This error come due to FOREIGN KEY CONSTRAINT define for parent and child relational table and the attribute_id is not available in parent table so that you can't insert in child table.. Please check parent table and re-verify the attribute_id.

 

Let me know if it helps.

Let me know if it helps. You can raise a KUDOS if its really worth for you. Also if it solves your problem then please mark as SOLUTION.

Re: Error on Insert Product Data via MYSQL

yes... i mixed up the  dev database with the current site. Thank you