Question: Topics and learning 1 . Database management with PHP 1 . MySQLi 2 . PDO Task Description The aim of this lab is to use

Topics and learning
1. Database management with PHP
1. MySQLi
2. PDO
Task Description
The aim of this lab is to use MySQli and PDO to interact with the database that you created last week.
Follow the steps below.
MySQLi
1. Connect to your database either with the `mysqli_connect` function (procedural),
or by creating a `mysqli` object (OOP).
2. Write a query to select products with a specific category_id (e.g., category_id =1)
3. Output the results on the page in some way (e.g., table, list, plaintext). You can output in
whatever format you like.
4. Write a query to add a new product to the `products` table. You can choose the values of the
new row.
5. Create a prepared statement which selects products which are above a certain price (`prepare`
method). The price should not be hardcoded in the query; instead, create a variable with the
price in it, and bind it to the prepared statement (`bind_param` method).
6. Output the results on the page in some way (e.g., table, list, plaintext). You can output in
whatever format you like.
PDO
1. Create a new page to practise with PDO instead of MySQLi.
2. Connect to your database either by creating a `PDO` object.
3. Write a query to select products with a specific category_id (e.g., category_id =1)
4. Output the results on the page in some way (e.g., table, list, plaintext). You can output in
whatever format you like.
5. Write a query to update the `price` column of some product in the `products` table.
You can choose which row to update, as well as the new price.
6. Create a prepared statement which selects products whose ids are greater than a certain number
(`prepare` method). This number should not be hardcoded in the query; instead, create a
variable with the number in it, and bind it to the prepared statement (`bindValue` method).
7. Output the results on the page in some way (e.g., table, list, plaintext). You can output in
whatever format you like.
Finishing up
1. Test your work and ensure the following code is included at the bottom of any uploaded files
echo "

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 Programming Questions!