Jump to content

ianc01

New Members
  • Posts

    2
  • Joined

  • Last visited

ianc01's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for the replies. As you can tell, I am fairly new to HTML/PHP coding. When I agreed to do this website, I didn't realize how difficult it would be; I bit off more than I could chew. Since I am new, I used an HTML/PHP template that is opensource from the Internet. This should show you my skill level. Please let me know what are good places to learn this properly since I am interested in website design. I know now that going this route may have seemed like a good idea but has actually been a detriment to me. I hope that I didn't offend anyone by going this route. mac_gyver, you gave me some great areas to incorporate into my future learning. I am going to relearn everything from the beginning for PHP/HTML/MySQL so that I can have a better understanding of everything. I found a good site to start learning from -> W3Schools.com. If anyone knows other sites to learn from, please let me know. As for the solution. gizmola gave me an idea when he said: I went and looked at the foreign keys set up in the sql file provided with the template and saw that they did reference the original database provided. I have since edited the keys to suit my changes. Like I said, I hope that this doesn't reflect badly on me for using code that was originally done by someone else. Thanks.
  2. 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
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.