Question: Create a PHP file to access your MySQLdatabase Create a PHP file and save it as guitar_list.php . (2) (3) Set the HTML title

Create a PHP file to access your MySQL database

  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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Below is the PHP code for your guitarlistphp file with the necessary HTML elements and PHP logic for ... View full answer

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!