Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!