Home / Expert Answers / Computer Science / help-please-nbsp-create-a-php-file-and-save-it-as-nbsp-guitar-list-php-2-3-set-the-nbsp-ht-pa472

(Solved): Help please! Create a PHP file and save itas guitar_list.php. (2) (3)Set the HT ...

Help please!


  1. Create a PHP file and save it as guitar_list.php. (2) (3)
  2. Set the HTML title element for your new page to be Product Listing: Guitars.
  3. Add an HTML comment at the top of the page which includes your name, WEB182, the date, and the file name.
  4. Add an HTML level 1 heading ( h1) - Product Listing: Guitars - to the page.
  5. Using Figure 4-1 from the textbook (p. 127) as a guide, add PHP code to your file which will:
    1. Connect to your database (1) (4)
  6. Using Figure 4-2 from the textbook (p. 129) as a guide, add PHP code to your file which will:
    1. Use a try/catch statement to handle a PDO exception and display an error message.
  7. Using Figure 4-5 from the textbook (p. 135) as a guide, add PHP code to your file which will:
    1.  Select fields from the gtr_shop1_products table for all items with a categoryID equal to 1
    2. Use a foreach loop to display the following field values in an HTML table (include table headings) (3)
    • productID
    • productCode
    • productName
    • listPrice

* Create the gtr_shop1 tables

-- create the tables
CREATE TABLE gtr_shop1_categories (
  categoryID       INT(11)        NOT NULL   AUTO_INCREMENT,
  categoryName     VARCHAR(255)   NOT NULL,
  PRIMARY KEY (categoryID)

CREATE TABLE gtr_shop1_products (
  productID        INT(11)        NOT NULL   AUTO_INCREMENT,
  categoryID       INT(11)        NOT NULL,
  productCode      VARCHAR(10)    NOT NULL   UNIQUE,
  productName      VARCHAR(255)   NOT NULL,
  listPrice        DECIMAL(10,2)  NOT NULL,
  PRIMARY KEY (productID)

CREATE TABLE gtr_shop1_orders (
  orderID        INT(11)        NOT NULL   AUTO_INCREMENT,
  customerID     INT            NOT NULL,
  orderDate      DATETIME       NOT NULL,

-- insert data into the database
INSERT IGNORE INTO gtr_shop1_categories VALUES
(1, 'Guitars'),
(2, 'Basses'),
(3, 'Drums');

INSERT IGNORE INTO gtr_shop1_products VALUES
(1, 1, 'strat', 'Fender Stratocaster', '699.00'),
(2, 1, 'les_paul', 'Gibson Les Paul', '1199.00'),
(3, 1, 'sg', 'Gibson SG', '2517.00'),
(4, 1, 'fg700s', 'Yamaha FG700S', '489.99'),
(5, 1, 'washburn', 'Washburn D10S', '299.00'),
(6, 1, 'rodriguez', 'Rodriguez Caballero 11', '415.00'),
(7, 2, 'precision', 'Fender Precision', '799.99'),
(8, 2, 'hofner', 'Hofner Icon', '499.99'),
(9, 3, 'ludwig', 'Ludwig 5-piece Drum Set with Cymbals', '699.99'),
(10, 3, 'tama', 'Tama 5-Piece Drum Set with Cymbals', '799.99');



We have an Answer from Expert

View Expert Answer

Expert Answer

P Answer for the question is below- code:

We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe