472,341 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,341 software developers and data experts.

Mysql Using Navicat (error --- Foreign Key Fails)

Hi I am new at ASP and MYSQL.

I am Using Navicat to access MYSQL database.

My Problem is when i create the foreign key in "Navicat" -it gives me this error.

1452-cannot add or update child row: a foreign key constraint fails....

Can any body help me - why am i getting this error - and how to fix it --

Is anything wrong --- I am trying since 2 days - no one knows how to fix it ?

Thanks,
Harsh (INDIA)
Jun 18 '07 #1
4 9654
r035198x
13,262 8TB
Hi I am new at ASP and MYSQL.

I am Using Navicat to access MYSQL database.

My Problem is when i create the foreign key in "Navicat" -it gives me this error.

1452-cannot add or update child row: a foreign key constraint fails....

Can any body help me - why am i getting this error - and how to fix it --

Is anything wrong --- I am trying since 2 days - no one knows how to fix it ?

Thanks,
Harsh (INDIA)
Apparently a foreign key constraint has failed. You can use

Expand|Select|Wrap|Line Numbers
  1. show innodb status; 
to show the last foreign key constraint that failed.
Jun 18 '07 #2
Apparently a foreign key constraint has failed. You can use

Expand|Select|Wrap|Line Numbers
  1. show innodb status; 
to show the last foreign key constraint that failed.
I am sorry but i did not get it. I am using Navicat that is only GUI no code section.

Details: I want to do relationships with two tables. Players and Manufacturers

To do that in VWD. i have to assign the index key and foreign key in Navicat.

When i put the Index key it works but when i assign foreign key -- it ask me to put the reference table and choose the columns i want.

I choose - what i want and when i click ok i get this error that

Foreign Key constraint Fails:------


Thanks in advance,
Harsh
Jun 18 '07 #3
r035198x
13,262 8TB
I am sorry but i did not get it. I am using Navicat that is only GUI no code section.

Details: I want to do relationships with two tables. Players and Manufacturers

To do that in VWD. i have to assign the index key and foreign key in Navicat.

When i put the Index key it works but when i assign foreign key -- it ask me to put the reference table and choose the columns i want.

I choose - what i want and when i click ok i get this error that

Foreign Key constraint Fails:------


Thanks in advance,
Harsh
Well you have to understand your tables and the constraints that exist on them. Something is happening to a foreign key which is not allowed by one of your constraints. Check against your constratints.
Jun 18 '07 #4
i meet the same error. I found my mistake is I inserted data, which not corresponding to both table before I create foreign key.

Ex: table a(id, name) with 2 record (1,peter); (2, flower)
table b(id, sex) with 3 record (1, male); (2, female); (3, male)
so when create foreign key for id of table b -> id of table a, record 3 of table b can't find any record of table a correspond.
Sep 9 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: linus | last post by:
Anyone try insert image or binary files to MySQL using ASP.NET? Thanks a lot
1
by: Devendra | last post by:
How could i insert a pdf file in mysql using PHP and when i access from database it must be open in .html format plz give me reply
0
by: Ginoboy | last post by:
Hello there I have a problem in executing mysql using java netbeans. all i want is to execute a batch file. this is my code: "try...
1
by: mohammedsk | last post by:
Hi, I am trying to save information into MySQL using PHP. The data I am saving is in Arabic language. The database table will show some "???" or...
3
by: haridelphi | last post by:
I download MySQL 5.0.37 from dev.mysql.com/downloads/mysql (Windows (x86) ZIP/Setup.EXE- 37 MB). When install it, i get the Error Message as...
9
paulrajj
by: paulrajj | last post by:
hi everybody, i am newbie to php and mysql. i have a little bit knowledge about php with xml. how to insert and select the records...
3
by: emsik1001 | last post by:
Hi http://dev.mysql.com/doc/query-browser/en/mysql-query-browser-connection.html I'm trying to connect from my Windows based PC to a dedicated...
1
Raymond Ng
by: Raymond Ng | last post by:
please help because i got a problem on how to access my MySQL Database from Online using Navicat for MySQL.. because i got a problem connecting my...
4
by: apssiva | last post by:
Hi, i tiring to insert excel data into mysql using php. 1. i saved the Excel data as a CSV file. 2. i use below code to retrieve data. ...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.