Please help,I'm very frustated.
when I ADD
the data in kn_history_question table of htbase_tst database....it giving the error "Cannot add or update a child row:a foreign key constraint fails,<'htbase_tst/kn_history_question', CONSTRAINT 'FK_kn_history_question_complaint' FOREIGN KEY ('complaint_id' ) REFERENCES 'complaint'('id')).
This is my table script.....
CREATE TABLE `city` (
`id` int(11) NOT NULL auto_increment,
`city_name` varchar(255) default NULL,
`city_code` varchar(80) default NULL,
`state_id` int(11) default NULL,
`Nearest_airport_code` varchar(80) default NULL,
`date_updated` timestamp NULL default NULL,
`date_created` timestamp NULL default NULL,
PRIMARY KEY (`id`),
KEY `FK_cities_states` (`state_id`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
CREATE TABLE `kn_history_question` (
`id` int(11) NOT NULL auto_increment,
`complaint_id` int(11) default NULL,
`question_text` varchar(255) default NULL,
`sex_relevance` varchar(20) default NULL,
`age_group_relevance` varchar(255) default NULL,
`date_created` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`date_updated` timestamp NOT NULL default '0000-00-00 00:00:00',
`count_of_responses` int(5) default NULL COMMENT ', paint radio buttons if value is one else check boxes',
`doctor_id` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `FK_kn_history_question_complaint` (`complaint_id`),
CONSTRAINT `FK_kn_history_question_complaint` FOREIGN KEY (`complaint_id`) REFERENCES `complaint` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ERROR:"Cannot add or update a child row:a foreign key constraint fails,<'htbase_tst/kn_history_question', CONSTRAINT 'FK_kn_history_question_complaint' FOREIGN KEY ('complaint_id' ) REFERENCES 'complaint'('id')).
Please give the solution of this ERROR.