Hello everyone,
I am developing a website for a friend's restaurant. For this site, I am setting up the site with their lunch & dinner menus, the ability to reserve a table, and to do online food ordering. So far, I have the menus working (just have to add photos for each menu item). I am in the process of developing the table reservation and online food ordering pickup/delivery.
I decided to use a new MariaDB database and switch over to the new one. The old database listed all the menu items in a table called "menus" whereas in the new database, I split this into two tables: "lunch_menu" and "dinner" menu. I managed to get the lunch and dinner menus to display on their own pages and they work (getting the menu items and displaying them).
The problem I am having is that in the process of changing the code for the food ordering, part of it still is trying to access the old "menu" table and I can't find where I went wrong. I am missing something somewhere and am wondering if someone would be able to see what I am doing wrong.
Here is the full HTML/PHP code I am using:
When I am testing the page, it displays all the correct menu items from the lunch_menu table. When I fill in the customers information and submit it, I get the following error:
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`thaicook3`.`in_order`, CONSTRAINT `fk_menu` FOREIGN KEY (`menu_id`) REFERENCES `menus` (`menu_id`))
It is still referencing the menus table and I can't see why in the code. If someone would be able to spot where I am going wrong, that would be great.
Thanks in advance.
lunch_menu.txt