Hey guys,
I'm not sure what I'm doing wrong. I have about 15 tables, but I'll give one example.
Here's the queries:
So when I change "New Hire" to something else, in the ranks table, it doesn't update in the pilots table.Code:CREATE TABLE `phpvms_airlines` ( `id` INT NOT NULL AUTO_INCREMENT , `code` VARCHAR( 3 ) NOT NULL , `name` VARCHAR( 30 ) NOT NULL , PRIMARY KEY ( `id` ), UNIQUE KEY `code` (`code`) )ENGINE=INNODB; CREATE TABLE `phpvms_ranks` ( `rankid` int(11) NOT NULL auto_increment, `rank` varchar(32) NOT NULL default '', `minhours` smallint(6) NOT NULL default '0', PRIMARY KEY (`rankid`), UNIQUE KEY `rank` (`rank`) )ENGINE=INNODB; INSERT INTO `phpvms_ranks` VALUES(1, 'New Hire', 0); CREATE TABLE `phpvms_pilots` ( `pilotid` int(11) NOT NULL auto_increment, `firstname` varchar(25) NOT NULL default '', `lastname` varchar(25) NOT NULL default '', `email` varchar(32) NOT NULL default '', `code` varchar(3) NOT NULL default '', `location` varchar(32) NOT NULL default '', `password` varchar(32) NOT NULL default '', `salt` varchar(32) NOT NULL default '', `lastlogin` date NOT NULL default '0000-00-00', `totalflights` int(11) NOT NULL default '0', `totalhours` float NOT NULL default '0', `rank` varchar(32) NOT NULL default 'New Hire', `confirmed` enum('y','n') NOT NULL default 'n', `retired` enum('y','n') NOT NULL default 'y', PRIMARY KEY (`pilotid`), UNIQUE KEY `email` (`email`), FOREIGN KEY (`code`) REFERENCES phpvms_airlines(`code`) ON UPDATE CASCADE, FOREIGN KEY (`rank`) REFERENCES phpvms_ranks(`rank`) ON UPDATE CASCADE )ENGINE=INNODB;
This same thing whenever I update the other fields.
The engine is correct, it seems. And it seems to be creating the keys (when I mess with them, I do get errors, like if I change the column name or something).
Same thing happens when I update the 'code' in the airlines table.
So, what am I missing, or am I getting the usage/concept completely wrong?









Bookmarks