Logo  

CS479/579 - Web Programming II

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. The vid should 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.txt the fields of which are:

    1. The item id
    2. The component type
    3. The vendor name
    4. Model number
    5. Item description
    6. Price
    7. Amount in inventory
  • Using the data, make a table called inventory that contains:

    1. The item id, a primary key
    2. The component id (from the component table), an index
    3. The vendor id (from the vendors table), also an index
    4. The model number
    5. Item description
    6. Price
    7. Amount in inventory

The resulting database schemas should be:

vendor(vid, name)
component(cid, name)
inventory(iid, cid, vid, model, description, price, amount)