Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am having issues completing this excercise. Here is the exercise, and my code will be below it. Part 2, More databases to forms: The

I am having issues completing this excercise.

Here is the exercise, and my code will be below it.

Part 2, More databases to forms: The database weblab has a table of tools named tool_t. The table was created as follows:

CREATE TABLE tool_t ( tool_item_no char(10) PRIMARY KEY, tool_name char(20), tool_price numeric(6, 2), tool_weight numeric(4, 1), tool_picture char(30), tool_description varchar); 

Change your order form to construct the item names, prices and weights by extracting the items from the database rather than hard-coding them. Display every item from the database. Do not assume that there will be a given number of items.

In the database table definition above, numeric(6, 2) means the item has a total of six digits, of which two are to the right of the decimal point.

Your order form should display the following items for each tool:

Name

Price

Shipping Weight

Each idem of your form should have a box to allow the customer to enter quantity as you did in earlier assignments.

You will not need the tool_picture or tool_description attributes. Present the tool names in alphabetical order. The following is a suitable query for retrieving from the database:

select tool_item_no, tool_name, tool_price, tool_weight from tool_t order by tool_name; 

------------------------------------------------------------------

Here is Code

--------------------------------------------------------------

Title

Tools Order

Tool Name Price per Unit
Chisel $5.00
Planer $10.00
Pitchfork $15.00

Customer Name
Chisel Quantity
Planer Quantity
Pitchforks Quantity
ShippingAddress
Your State

$dbName = "weblab";

// Creating the connection

$conn = new mysqli(null,null,null,$dbName);

// check connection

if ($conn->connect_error)

{

die("Connection Failed" . $conn->connect_error);

}

?>

$statesList = "SELECT state-abbr, state_name FROM state_t ORDER BY state_name ASC";

$result = $conn->query($statesList);

$statesListDropDown = "";

$statesListDropDown = "

";

}

else

{

echo "No States Found";

}

$conn->close();

echo $statesListDropDown;

?>

Payment Mode

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions

Question

T F Packaging has little infl uence on buying decisions.

Answered: 1 week ago