Question: murach's php and mysql 4 th edition Exercise 1 9 - 1 / pg 6 6 7 Exercise 1 9 - 1 Use PHP to

murach's php and mysql 4th edition Exercise 19-1/ pg 667
Exercise 19-1 Use PHP to work with a database.
Review and test the code
1. Run the application in the ex_starts/ch19_ex1 directory. This should display the names of the products in the Basses category, a delete message, and an insert message.
2. Open the database.php file the product_db.php file, the category_db.php file, and the index.php file. Then, review the cod. Note that this code uses PDO.
3. If you want to use mysqli instead of PDO, replace the database.php, product_db.php, and category_+db.php files with the database.php, product_db.php, and category_db.php files that are in the book_apps/ ch20_guitar_shop_mysqli/model directory.
Modify the code
4. Modify the index.php file so it displays the products that are in the Guitars category.
5. Modify the index.php file so it uses a method from the model to add a product. When you do that, use the sample data thats already in the index.phpfile. Make sure this code displays an appropriate message that indicates whether the product was inserted. Note that the products table requires a unique product code for each product. As a result, you cant insert the same product code twice.
6. Add a method to the model named getProductByName(). This method should have a parameter for the product name and it should return a product object for the product with the specified name. This provides a way to get the product ID and other product data that corresponds to the product name.
7. Modify the index.php file so it uses a method from the model to delete the product named Fender Telecaster. To do that, you can use the method that you created in the previous step to get the product ID. Make sure this code displays an appropriate message that indicates whether the product was deleted.
8. Test the code to make sure it works correctly. If it does, it should display the products, add a product, and display appropriate messages.

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!