How can you establish a connection between PHP and MySQL?
2025
How can you establish a connection between PHP and MySQL?
Answer: D. By using the "mysqli_connect()" function in PHP — In PHP, a MySQL connection can be established using mysqli_connect(), passing the server, username, password and database details as needed.
- A.
Using the "connect()" function in PHP
- B.
By including a PHP library
- C.
By embedding MySQL queries directly in PHP code
- D.
By using the "mysqli_connect()" function in PHP
Attempted by 217 students.
Show answer & explanation
Correct answer: D
In PHP, a MySQL connection can be established using mysqli_connect(), passing the server, username, password and database details as needed.
Loading lesson…