List the item ids and their location description

Assignment Help PHP Web Programming
Reference no: EM13316607

In this assignment youare required to use PHP program to connect to the XAMPP web server. You will then create a database which will include tables with records.

Connect to the web server using PHP program.

1.      Download XAMPP application from https://www.apachefriends.org/index.html or any other authorized website.

2.      Run the web server from xampp-control application. You need to start the Apache and MySQL application in the control panel.

3.      Click the Admin tab to open the web server.

4.      To view the databases, click the phpMyAdminlink under Tools. This will show all the existing databases and tables in the server.

5.      To connect to MySQL use the template testmysql.php file already provided to you. The mysql_connect function uses the shortcut 'localhost' and the username 'root' to connect. There is no password. Save the file using your last name with a phpextension inside the 'htdocs' folder.You can use any text editor to write the php program. To run the php file open a web browser. Write https://localhost/yourlastname.php in the url to run the file.

Create a database and tables.

1.      Use mysql_queryfunction in the php file to create a database named 'Assignment4' in the web server. It is always preferred to use 'IF NOT EXISTS' keywords while creating a database and a table. All the queries should be inside a quotation mark and should end with a semicolon.

2.      Use mysql_select_db function to connect to the database 'Assignment4'.

3.      Create a table named 'Inventory' in the database 'Assignment4' with following fields:

 

Inventory

INV_ID (PK)

ITEM_ID

ITEM_QTY

VEND_ID

LOC_ID

STORE_QTY

LOC_DESCRIPTION

 

INV_ID is the primary key and should not be NULL. Use AUTO_INCREMENT for the primary key. Both VEND_ID and LOC_DESCRIPTION should be character type while other fields are integer type.

Insert multiple rows in the table.

1.      To insert multiple rows use the following query (see lecture 8, slide 22):

INSERT INTO table_name (column1, column2) VALUES

(R1C1, R1C2), (R2C1, R2C2),...;

Populate the Inventory table with the following datalines:

2,6,'P14',1,17,'WAREHOUSE1'

3,9,'D07',1,7,'WAREHOUSE1'

4,6,'D08',1,5,'WAREHOUSE1'

7,10,'P11',1,14,'WAREHOUSE1'

4,6,'D08',2,13,'WAREHOUSE2'

5,5,'D09',2,23,'WAREHOUSE2'

10,6,'D06',2,18,'WAREHOUSE2'

5,5,'D09',3,8,'WAREHOUSE3'

8,10,'P12',3,13,'WAREHOUSE3'

9,9,'P13',3,6,'WAREHOUSE3'

11,8,'D07',3,5,'WAREHOUSE3'

1,2,'P13',4,5,'WAREHOUSE4'

3,9,'D07',4,20,'WAREHOUSE4'

6,4,'P10',4,11,'WAREHOUSE4'

11,8,'D07',4,6,'WAREHOUSE4'

12,8,'P12',4,9,'WAREHOUSE4'

Create more tables.

1.      Use the Inventory table to create the following three tables.

Item

ITEM_ID (PK)

ITEM_QTY

VEND_ID

 

 

Storage

ITEM_ID (PK)

LOC_ID (PK)

STORE_QTY

 

 

Location

LOC_ID (PK)

LOC_DESCRIPTION

 

 

2.      Use foreign keys to link the above three tables. There is no need to link these tables with the Inventory table.

3.      Insert values in the above tables from the Inventory table. Use the DISTINCT keyword if necessary to reduce redundancy while inserting the values. Both Inventory and Storage tables should have 16 rows. Item table should have 12 rows and Location table should have 4 rows.

All the above queries should be written in the php file using mysql_queryfunction and saved as your last name. Check the web server to see if all the tables are populated as desired. You can check the relationships among the tables by clicking the Designer tab inside the database.

Write queries.

Open the SQL tab in the Assignment4 database for writing queries. Use the tables Item, Storage and Location in the queries as required. Do not use the Inventory table for any of the queries. You can run the query by clicking the 'Go' tab at the bottom right corner of the query window.

1.      List the item IDs and their location description of the items whose item quantity is more than their storage quantity. (Query should return 5 rows)

2.      Suppose warehouse 2 and 4 charges $1.2 per item for all the items with store quantity more than 15. For example, ITEM_ID = 10 has STORE_QTY = 18 in the warehouse 2, hence the total storage cost for this item is 18*1.2 = 21.6. List all such items in the warehouse 2 and 4 along with their total storage cost. Name the cost as TOTCOST. (Query should return 3 rows)

Save the queries and the results in a Word document. Use your last name as the file name.

Note:

The submission should be a PHP file and a Word document. Use your last name as the files name.The PHP file should be able to connect to the web server, create the database and the tables, and insert the values in all the tables when run. The Word document should have the two queries and the results obtained from each query.

Reference no: EM13316607

Questions Cloud

Determine the hydraulic conductivity of the soil : In a constant-head permeability test a sample of soil12 cm long and 6 cm in diameter discharged at 1.5*10^-3 of water in 10 minutes. The head difference in two piezometers A and B located at 1 cm and 11 cm, respectively
Compute the horizontal pushing force : A 55.0 kg crate rests on a level floor at a shipping dock. What horizontal pushing force is required to just start the crate moving
What is their order from left to right : Three infinite nonconducting sheets, with uniform positive surface charge densities, sigma, 2sigma, and 3sigma, are arranged to be parallel. What is their order, from left to right
Calculate volume of thickened sludge with solids recovery : A gravity thickener receives 33.000 Lpd of wastewater sludge and increases the solids content from 3.0% to 7.0% with 90% solids recovery. Calculate the volume of thickened sludge.
List the item ids and their location description : In this assignment youare required to use PHP program to connect to the XAMPP web server. You will then create a database which will include tables with records.
What is the density on a hot day : The density of gasoline at 0 degrees celsius is 0.68E3 kg/m^3. What is the density on a hot day when the temperature is 35 degrees celsius
How to use the bisection method on the van der waals : how to use the bisection method on the van der waals equation Problem 1 (15 Points) The van der Waals equation gives a relationship between the pressure P (in atm.), volume V (in L), and temperature T (in K) for a real gas
Convert the formula so that q is in gallons per minute : The flow of water over a weir, can be computed by Q=5.35LH^(3/2), where Q is the volume low rate of water in cubic feet per second, L is the length of weir in feet, and H is the height of water over the weir in feet.
Find the tension in the cable holding up the boom : A 1450 N uniform boom is supported by a cable as shown. The boom is pivoted at the bottom, and a 1270 N object hangs from its end. Find the tension in the cable holding up the boom

Reviews

Write a Review

 

PHP Web Programming Questions & Answers

  Php program to identify leap year

Given a variable called $year, create a PHP program that will print out " is a leap year" or " is not a leap year".

  Sample website project

This website consists of three sections: a narrative, a storyboard, and a business Website.

  Encryption and hashing

securing a new web server and a new web application, input validation, CSRF attack, SQL injection vulnerability, Cross Site Scripting (XSS) attack, architecture mechanism Linux, Apache, MySQL, and PHP,

  Develop an opinion as to the degree

As we noted in the lecture some educationalists are quick to point out that hypertext links facilitate memory and understanding and this has lead to encouragement of WWW use in the classroom.

  Simple php script to parse out custom lines

Simple php script to parse out custom lines from an log file and echo - the script should echo it after convert it from hex to normal text

  Prepare an ajax enabled web form

Prepare an AJAX enabled web form utilising a ListView control that will allow logged-in staff to list, edit, delete, insert magazine details for magazines from a selected magazine category.

  An array

Write a simple PHP program that prints the days of the week using three different methods: using plain HTML, using echo statements and using an array. Ensure correct documentation, indentation, var names etc.

  Why do we create a web site plan

Why do we create a web site plan?2. What are the several types of objectives?

  This problem is pertaining to the html language

CS5334.0251/0252, Spring, 2014 Assignment, Advanced Internet Information Processing subject, This problem is pertaining to the HTML language. You can create your own web page by placing an HTML page in the “public html” directory within your home dir..

  Show the accessibility and usability of website

The webpage must have several menus about country Azerbaijan such as "About Azerbaijan" "History" "Geography" "Landscape" and "Accessibility" menu.

  Model view controller pattern

PHP Frameworks, class patterns and object patterns, Object Oriented Design Principles, Program to an ‘interface' not to an Implementation, Open Close Principle, Principle of Least Knowledge, creational design prototypes, Dependency Inversion principl..

  Create a form that sends data to best_songs.php on a server

Create a form that sends data to best_songs.php on a server. The form should have a text box for your name and a collection of at least four checkboxes representing kinds of songs and a radio button to indicate whether the selected items are to be so..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd