Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions

Question

Example. Evaluate 5n+7 lim 7-00 3n-5

Answered: 1 week ago