mysql insert not working

Posted on 2012-09-22
Last Modified: 2012-09-22

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` ,
'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.

Question by:movieprodw
    LVL 7

    Accepted Solution

    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.
    LVL 1

    Author Comment

    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.
    LVL 1

    Author Closing Comment


    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
    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…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    733 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

    Need Help in Real-Time?

    Connect with top rated Experts

    26 Experts available now in Live!

    Get 1:1 Help Now