I had a similar problem i solved it by checking the file referenced in the error and the line. $sql = "INSERT INTO details (first_name, last_name, email, age) VALUES ('$first_name', '$last_name', '$email', '$age')" Įcho "ERROR: Could not able to execute $sql. $age = mysqli_real_escape_string($link, $_REQUEST) $email = mysqli_real_escape_string($link, $_REQUEST) $last_name = mysqli_real_escape_string($link, $_REQUEST) $first_name = mysqli_real_escape_string($link, $_REQUEST) $link = mysqli_connect("localhost", "root", "", "record") ĭie("ERROR: Could not connect. Server with default setting (user 'root' with no password) */ details, CONSTRAINT details_ibfk_1 FOREIGN KEY ( id) REFERENCES users ( id)) /* Attempt MySQL server connection.
Cannot add or update a child row: a foreign key constraint fails ( record. Warning: Undefined array key "age" in C:\xampp\htdocs\children_math\detail2.php on line 15ĮRROR: Could not able to execute INSERT INTO details (first_name, last_name, email, age) VALUES ('', '', '', ''). Warning: Undefined array key "email" in C:\xampp\htdocs\children_math\detail2.php on line 14
Warning: Undefined array key "last_name" in C:\xampp\htdocs\children_math\detail2.php on line 13 Warning: Undefined array key "first_name" in C:\xampp\htdocs\children_math\detail2.php on line 12 Below The first code I save as details.php and the second on as details.html