πŸ“Š PHP
Q. Which of the following is a correct way to connect to MySQL using PDO?
  • (A) new PDO('mysql:host=localhost;dbname=test', 'root', '');
  • (B) pdo_connect('localhost','root','');
  • (C) PDO_connect('test');
  • (D) new pdo_mysql('root','test');
πŸ’¬ Discuss
βœ… Correct Answer: (A) new PDO('mysql:host=localhost;dbname=test', 'root', '');

Explanation: The correct way is to create a PDO instance with DSN, username, and password.

Explanation by: Rati Dubey
The correct way is to create a PDO instance with DSN, username, and password.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
33
Total Visits
πŸ“½οΈ
3 mo ago
Published
πŸŽ–οΈ
Rati Dubey
Publisher
πŸ“ˆ
81%
Success Rate