473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 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 9808
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 other characters. If I insert the text directly...
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 "Cannot create windows service for MySQL...
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 from xml to mysql using php?
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 server which is running on Linux system. I...
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 Database from Online.. please help me guys to...
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. $fcontents = file('./ite_APS.csv');...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.