mysql error message: #1452 - Cannot add or update a child row: a foreign key constraint fails

51 Views Asked by At

Recently I installed this 2 years old laravel template with php 7.4. Template was working smoothly before, but now getting this error.

When import the database on phpmyadmin:

mysql error message:

#1452 - Cannot add or update a child row: a foreign key constraint fails (idif6594_test.#sql-alter-cd0b6-1b44b2, CONSTRAINT content_details_language_id_foreign FOREIGN KEY (language_id) REFERENCES languages (id))

SQL query:

---- Constraints for dumped tables
---- Constraints for table content_details

ALTER TABLE `content_details`  
  ADD CONSTRAINT `content_details_content_id_foreign` 
      FOREIGN KEY (`content_id`) REFERENCES `contents` (`id`),
  ADD CONSTRAINT `content_details_language_id_foreign` 
      FOREIGN KEY (`language_id`) REFERENCES `languages` (`id`);

And when I tried to login to the dashboard, laravel give this error:

ErrorException

Trying to get property 'success' of non-object

Illuminate\Foundation\Bootstrap\HandleExceptions::handleError vendor/jlang/jsonstringfy/src/Services/RequestResolve.php:32

======

phpmyadmin

Server version: 10.6.16-MariaDB-cll-lve - MariaDB Server

Database client version: libmysql - mysqlnd 8.1.27

PHP extension: mysqli, curl, mbstring

PHP version: 8.1.27

0

There are 0 best solutions below