Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

There will be a page for looking at the catalogue of items. A new table will be

ID: 3920416 • Letter: T

Question

There will be a page for looking at the catalogue of items. A new table will be made of all the items to be sold.

Step 1

Enter the MYSQL admin and create a table called products then

The table will have

ProductID

Name

Description

Price

After you have created the table you will insert these items

Anvil

Axle Grease

Atom Re-Arranger

Bed Springs

Bird Seed

Blasting Powder

Cork

Dsintigration Pistol

Earthquake Pills

Female Roadrunner costume

Giant Rubber Band

Instant Girl

Iron Carrot

Jet Propelled Unicycle

Out-Board Motor

Railroad Track

Rocket Sled

Super Outfit

Time Space Gun

X-Ray

Step 3

Create a catalogue page called catalogue.php and then add the text

“Please select one of our items:” then an options/drop down box

The PHP will call the database and then populate the box with each of the items.

Anvil

Axle Grease

Atom Re-Arranger

Bed Springs

Bird Seed

Blasting Powder

Cork

Dsintigration Pistol

Earthquake Pills

Female Roadrunner costume

Giant Rubber Band

Instant Girl

Iron Carrot

Jet Propelled Unicycle

Out-Board Motor

Railroad Track

Rocket Sled

Super Outfit

Time Space Gun

X-Ray

Explanation / Answer

If you have any doubts, please give me comment...

CREATE TABLE products(

ProductID INT NOT NULL PRIMARY KEY,

Name VARCHAR(50),

Description VARCHAR(255),

Price FLOAT(5,2)

);

INSERT INTO products(Name) VALUES('Anvil'),('Axle Grease'), ('Atom Re-Arranger'), ('Bed Springs'), ('Bird Seed'), ('Blasting Powder'), ('Cork'), ('Dsintigration Pistol'), ('Earthquake Pills'), ('Female Roadrunner costume'), ('Giant Rubber Band'), ('Instant Girl'), ('Iron Carrot'), ('Jet Propelled Unicycle'), ('Out-Board Motor'), ('Railroad Track'), ('Rocket Sled'), ('Super Outfit'), ('Time Space Gun'), ('X-Ray');

catelogue.php

<?php

$servername = "localhost";

$username = "username";

$password = "password";

$dbname = "myDB";

$conn = mysqli_connect($servername, $username, $password, $dbname);

if (!$conn) {

die("Connection failed: " . mysqli_connect_error());

}

$sql = "SELECT ProductID, `Name` FROM products";

$result = mysqli_query($conn, $sql);

echo "<select>";

echo "<option>Please select one of our items</option>";

if (mysqli_num_rows($result) > 0) {

while($row = mysqli_fetch_assoc($result)) {

echo "<option value='".$result['ProductID']."'>".$row['Name']."</option>";

}

}

echo "</select>";

mysqli_close($conn);

?>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote