Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask PHP Expert

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 http://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.

PHP , Programming

  • Category:- PHP
  • Reference No.:- M9895919
  • Price:- $70

Priced at Now at $70, Verified Solution

Have any Question?


Related Questions in PHP

Question using the course software and week one template as

Question: Using the course software and Week One Template as a starting point, create a new HTML webpage and include the following: • Write the code to display your name in the largest-size heading element. • Write the m ...

Question develop a 5-6 page word document that describes

Question: Develop a 5-6 page Word document that describes the design for a small Web site that meets the following specifications. 1. The Web site includes four or more Web pages designed according to current usability g ...

Question continue to build on the skills of providing web

Question: Continue to build on the skills of providing Web page content and structure with HTML and Web page style and layout using CSS. Demonstrate the skill of creating a dynamic Web page that includes JavaScript clien ...

In php write a simple addtion calculator that reads in two

In PHP write a simple addtion calculator that reads in two values and then add them together and display the output. Be sure to validate both inputs and ensure that it can add 0+0 = Sum: 0. The user should be able to inp ...

Final project assignment -requirements specifications -1

FINAL PROJECT ASSIGNMENT - REQUIREMENTS / SPECIFICATIONS - 1. For the final project, you will have to make good use of your CMS using PHP and MySQL for the content delivery. You will have to be able to deliver the conten ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As