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
Database management with PHP
MySQLi
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
Connect to your database either with the mysqliconnect function procedural
or by creating a mysqli object OOP
Write a query to select products with a specific categoryid eg categoryid
Output the results on the page in some way eg table, list, plaintext You can output in
whatever format you like.
Write a query to add a new product to the products table. You can choose the values of the
new row.
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 bindparam method
Output the results on the page in some way eg table, list, plaintext You can output in
whatever format you like.
PDO
Create a new page to practise with PDO instead of MySQLi.
Connect to your database either by creating a PDO object.
Write a query to select products with a specific categoryid eg categoryid
Output the results on the page in some way eg table, list, plaintext You can output in
whatever format you like.
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.
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
Output the results on the page in some way eg table, list, plaintext You can output in
whatever format you like.
Finishing up
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
