Beim Login kommt eine Fehlermeldung und man wird komischerweise auf die url http://localhost/shop/index.php/cart/add/3 geleitet, der Login an sich klappt aber. Und wenn es es Produkt mit der Id 3 gibt, dann wird das in den Warenkrob hintugefügt.
Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (test.cart, CONSTRAINT FK_cart_product FOREIGN KEY (product_id) REFERENCES products (id) ON DELETE SET NULL ON UPDATE CASCADE) in C:\xampp\htdocs\shop\function\cart.php:17 Stack trace: #0 C:\xampp\htdocs\shop\function\cart.php(17): PDOStatement->execute(Array) #1 C:\xampp\htdocs\shop\actions\cart\add.php(4): addProductToCart(1, 3) #2 C:\xampp\htdocs\shop\routes.php(220): require_once('C:\xampp\htdocs...') #3 C:\xampp\htdocs\shop\function\utilities.php(209): {closure}('cart', '/add', '3') #4 C:\xampp\htdocs\shop\routes.php(242): router('GET_/cart/add/3') #5 C:\xampp\htdocs\shop\includes.php(26): require_once('C:\xampp\htdocs...') #6 C:\xampp\htdocs\shop\index.php(13): require('C:\xampp\htdocs...') #7 {main} thrown in C:\xampp\htdocs\shop\function\cart.php on line 17
Beim Login kommt eine Fehlermeldung und man wird komischerweise auf die url http://localhost/shop/index.php/cart/add/3 geleitet, der Login an sich klappt aber. Und wenn es es Produkt mit der Id 3 gibt, dann wird das in den Warenkrob hintugefügt.
Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (
test.cart, CONSTRAINTFK_cart_productFOREIGN KEY (product_id) REFERENCESproducts(id) ON DELETE SET NULL ON UPDATE CASCADE) in C:\xampp\htdocs\shop\function\cart.php:17 Stack trace: #0 C:\xampp\htdocs\shop\function\cart.php(17): PDOStatement->execute(Array) #1 C:\xampp\htdocs\shop\actions\cart\add.php(4): addProductToCart(1, 3) #2 C:\xampp\htdocs\shop\routes.php(220): require_once('C:\xampp\htdocs...') #3 C:\xampp\htdocs\shop\function\utilities.php(209): {closure}('cart', '/add', '3') #4 C:\xampp\htdocs\shop\routes.php(242): router('GET_/cart/add/3') #5 C:\xampp\htdocs\shop\includes.php(26): require_once('C:\xampp\htdocs...') #6 C:\xampp\htdocs\shop\index.php(13): require('C:\xampp\htdocs...') #7 {main} thrown in C:\xampp\htdocs\shop\function\cart.php on line 17