[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

mysql insert not working

Posted on 2012-09-22
3
Medium Priority
?
708 Views
Last Modified: 2012-09-22
Hello,

I am working with a table that has the structure in the attached screen shot.

I went to insert a row and got this error:

SQL query: Edit Edit

INSERT INTO `d_mage`.`catalog_product_entity-SKUS` (
`entity_id` ,
`entity_type_id` ,
`attribute_set_id` ,
`type_id` ,
`sku` ,
`has_options` ,
`required_options` ,
`created_at` ,
`updated_at`
)
VALUES (
'55555555', '', '', 'simple', '51515151', '0', '0', NOW( ) , NOW( )
)

MySQL said: Documentation
#1452 - Cannot add or update a child row: a foreign key constraint fails (`d_mage`.`catalog_product_entity-SKUS`, CONSTRAINT `FK_CAT_PRD_ENTT_ENTT_TYPE_ID_EAV_ENTT_TYPE_ENTT_TYPE_ID` FOREIGN KEY (`entity_type_id`) REFERENCES `eav_entity_type` (`entity_type_id)

Can you please help me figure out how I can insert a row without getting an error.

Thanks
Matt
Screen-Shot-2012-09-22-at-12.38..jpg
0
Comment
Question by:movieprodw
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
ziceva earned 2000 total points
ID: 38425201
Most likely the "simple" value of the "type_id" is wrong. Take a look at the table named "eav_entity_type" and see what is the ID of the type "simple" and use that ID.
0
 
LVL 1

Author Comment

by:movieprodw
ID: 38425221
You were correct that worked.

How about this.

When I go to delete the test one I just created it stalls the server and I had to restart.
0
 
LVL 1

Author Closing Comment

by:movieprodw
ID: 38425320
thanks
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month19 days, 5 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question