473,661 Members | 2,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

30 New Member
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 9841
r035198x
13,262 MVP
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
Harshpandya
30 New Member
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 MVP
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
cheerpeter13
1 New Member
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
1458
by: linus | last post by:
Anyone try insert image or binary files to MySQL using ASP.NET? Thanks a lot
1
3033
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
1317
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 { Runtime.getRuntime().exec("C:\\Program Files\\MySQL\\MySQL Server 4.1\\bin\\mysql.exe mysql -u root -p -D gino < C:\\projects\\sample\\gino.txt"); } catch(Exception e)
1
2690
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 through PHPMyAdmin it works, but not through PHP. I also, modified the PHP page to accept UTF-8 encoding. What other changes do I have to do? Thanks in advance,
3
2455
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 5.0.Error:0" . what it mean? Anyone recommeded me the correct URL to download the full version for MySQL 5 Thanks in advance
9
4656
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
4899
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 type server host and port 3306 user name admin + password and default schema and I get access denied message. I use putty to connect to the server using IP and port 22 and it connects to the server.
1
3190
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 resolve this problem. thanks! here is the info provided by my domain.
4
4421
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'); for($i=0;$i<sizeof($fcontents);$i++) {
0
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8855
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8758
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6185
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4346
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1986
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.