1. What does PDO stand for in PHP?
PDO stands for PHP Data Object. It provides a database abstraction layer that works with many database systems like MySQL, SQLite, and PostgreSQL.
$pdo = new PDO('mysql:host=localhost;dbname=test','root','pass');Get the Preplance app for a seamless learning experience. Practice offline, get daily streaks, and stay ahead with real-time interview updates.
Get it on
Google Play
4.9/5 Rating on Store
PHP · Question Set
Database Integration (MySQLi & PDO) interview questions for placements and exams.
Questions
4
Included in this set
Subject
PHP
Explore more sets
Difficulty
Mixed
Level of this set
Go through each question and its explanation. Use this set as a focused practice pack for PHP.
PDO stands for PHP Data Object. It provides a database abstraction layer that works with many database systems like MySQL, SQLite, and PostgreSQL.
$pdo = new PDO('mysql:host=localhost;dbname=test','root','pass');If mysqli_connect fails, it returns false. You can check this and display an error using mysqli_connect_error.
if(!$conn){ echo mysqli_connect_error(); }MySQLi stands for MySQL Improved. It allows PHP scripts to connect and interact with MySQL databases securely and efficiently.
$conn = mysqli_connect('localhost','root','pass','test');The mysqli_query function sends a query to the MySQL server and returns a result object for SELECT or true for successful INSERT, UPDATE, or DELETE operations.
$result = mysqli_query($conn,'SELECT * FROM users');
For complete preparation, combine this set with full subject-wise practice for PHP. You can also explore other subjects and sets from the links below.