Dear all, I have a problem in MySQL:
I failed to execute DELETE FROM users where user_id ='1';
in the MySQL CLI.
So I tried in the phpMyAdmin:
Use the GUI to delete a row, I got this:
SQL query:
DELETE FROM `health_portal`.`users` WHERE `users`.`user_id` =1
MySQL said: Documentation
Cannot delete or update a parent row: a foreign key constraint fails (`health_portal`.`users`, CONSTRAINT `users_ibfk_2` FOREIGN KEY (`doctor_id`) REFERENCES `users` (`user_id`))
I looked up this error in the Mysql website and got: Error: 1451 SQLSTATE: 23000 (ER_ROW_IS_REFERENCED_2)
Message: Cannot delete or update a parent row: a foreign key constraint fails (%s)
I don't know what is wrong here, hope anyone can give me a heads-up.
Many thx!