View Full Version : phpMyadmin Questions

01-11-2012, 06:21 PM
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:

INSERTINTO`rlbulbs`.`carmake` (

`modelID` ,
`model` ,

MySQL said:
#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)

Again, please excuse my newbness with databases, in particular with phpmyadmin, but any tips and help would be greatly appreciated.

01-12-2012, 08:43 AM
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.