hi, I have two tables as : please concentrate on domain_id and INDEX
Create table ls_domain ( domain_id INT(4) UNSIGNED AUTO_INCREMENT , domain_addr VARCHAR(80), domain_name CHAR(50) UNIQUE KEY, domain_port INT(6) UNSIGNED, domain_ip VARCHAR(15), created_by VARCHAR(40), created_date DATE, PRIMARY KEY (domain_id) ) TYPE=InnoDB; I have created and inserted values in it then.. Create table ls_user ( user_id INT(4) UNSIGNED AUTO_INCREMENT , domain_id INT(4), INDEX do_id (domain_id), user_name VARCHAR(30) UNIQUE KEY, user_flag CHAR(1) , user_passwd VARCHAR(8) , user_addr VARCHAR(100), user_email VARCHAR(50), created_by VARCHAR(30), created_date DATE, FOREIGN KEY (domain_id) REFERENCES ls_domain(domain_id), PRIMARY KEY (user_id) ) TYPE=InnoDB; It has also been created. Now when I am inserting values in ls_user it is giving error as mentioned below..( I have made sure that the value I am inserting for the 'domain_id' exists in the ls_domain table.) please tell me what could be the problem... INSERT INTO ls_user(ls_user,domain_id,user_name,user_flag,user_passwd,user_addr,user _email,created_by, created_date) VALUES(1,1,'Chetan Lavti','y','chetan','116-C,Mayur Vihar','[EMAIL PROTECTED]','Chetan Lavti','2002-02-07'); ERROR 1216: Cannot add a child row: a foreign key constraint fails Please, help me for the same... Thanks and regards, Chetan Lavti --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php