Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: phpMyadmin Questions
01-11-2012, 06:21 PM #1
- Join Date
- Aug 2010
- High Point, NC
- Thanked 363 Times in 360 Posts
Hi, I haven't dealt with creating tables in a long time, and even though this will be a coldfusion query on a MySQL database, I am in the middle of learning PHP so I thought I'd spend time learning how to admin databases using phpMyadmin.
I will say I also use Navicat as well. My problem is I'm working on a database for car lamp applications. So as of now I have 2 tables: carMaker and carMake. carMake is different models of a manufacture brand, so for instance Camaro, Chevelle, Belair all are Chevrolets. Falcon, Fairlane, Taurus all Fords.
I'll just show my table structures before describing my issue.
modelID model makerID
1 Camaro 2
2 Chevelle 2
3 Falcon 4
4 Fairlane 4
5 Challenger 5
This was created in Navicat. When I try to insert records using phpmyadmin, I get an error:
#1452 - Cannot add or update a child row: a foreign key constraint fails (`rlbulbs`.`carmake`, CONSTRAINT `carmake_ibfk_1` FOREIGN KEY (`modelID`) REFERENCES `carmaker` (`makerID`) ON UPDATE NO ACTION)
01-12-2012, 08:43 AM #2
- Join Date
- Jan 2010
- Thanked 2 Times in 2 Posts
Hmm well it looks like you have a foreign key constraint. That is you're referencing a value that doesn't exist in its reference table.
If I insert a host_id into the uptime table and the host_id doesn't exist in the hosts table and a foreign key contraint exists I'll get that error you're getting.
Nerd Stuff (code, rrdtool, monitoring, etc):