Description
Exercise #8
Edit the PHP script inventory.php (and config.php which should setup your
$myconn mysqli resource handle) and using the PHP (object oriented) mysqli
interface, take the three .txt files and create a set of tables in your
database for the data within them. The contents of the text files are:
vendors.txt
- A list of vendors that sell things. Create a '
vendor' table that contains both their name and a auto-incremented vender id (vid) for each vendor. Thevidshould be a primary key.
cids.txt
- A list of components and their ID's. Create a '
component' table with these two values.
inventory.txt
-
A list of items in
inventory.txtthe fields of which are:- The item id
- The component type
- The vendor name
- Model number
- Item description
- Price
- Amount in inventory
-
Using the data, make a table called
inventorythat contains:- The item id, a primary key
- The component id (from the component table), an index
- The vendor id (from the vendors table), also an index
- The model number
- Item description
- Price
- Amount in inventory
The resulting database schemas should be:
vendor(vid, name)
component(cid, name)
inventory(iid, cid, vid, model, description, price, amount)