简体   繁体   English

使用php程序和mysql通过html表单使用主键和外键将数据插入到多个表中

[英]Insertion of data into multiple table using primary key and foreign key through html form with php procedual and mysql

I am new to complicated databases.我是复杂数据库的新手。 I want to add supplier detail I the database, which has 3 tables with name product, supplier, and purchase invoice.我想在数据库中添加供应商详细信息,该数据库有 3 个表,其中包含名称产品、供应商和采购发票。

product have an id(primary key), product_name, and supplier_name(foreign key)产品有一个 id(主键)、product_name 和供应商名称(外键)

A supplier have a supplier_name and supplier_detail供应商有一个供应商名称和供应商详细信息

and purchase invoice have reference_no#(primary key) product_id(foreign key) product_price product_quantity amount_paid and purchase_date和购买发票有reference_no#(primary key) product_id(foreign key) product_price product_quantity amount_paid 和 purchase_date

I want to add detail in database using php form but how could I?我想使用 php 表单在数据库中添加详细信息,但我该怎么做? I am confusing with multiple table and foreign key.我对多个表和外键感到困惑。

Need suggestion as well as answer with source code?需要建议以及源代码的答案吗? And also I want to know is database I have created is correct or not?而且我想知道我创建的数据库是否正确?

I honestly would recommend you start reading first about relations in databases.老实说,我建议您首先阅读数据库中的关系。

This would help you a lot . 这会对你有很大帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM