menu

PHP Database Connection


1. Which of the following functions is used to roll back a transaction in PHP?

mysqli_rollback()

mysql_rollback()

pdo_rollback()

None of the above


2. Which of the following functions is used to fetch a row as an object from a result set in PHP?

mysqli_get_object()

mysql_fetch_object()

pdo_fetch_object()

mysqli_fetch_object()


3. Which of the following functions is used to return the ID of the last inserted row in a table in PHP?

mysqli_insert_id()

mysql_insert_id()

pdo_insert_id()

None of the above


4. Which of the following functions is used to execute a query in PHP?

mysqli_query()

mysql_query()

pdo_query()

None of the above


5. Which of the following functions is used to return the number of rows in a result set in PHP?

mysqli_num_rows()

mysql_num_rows()

pdo_num_rows()

None of the above


6. Which of the following functions is used to check if a database connection is still active in PHP?

mysql_ping()

mysqli_ping()

pdo_ping()

None of the above


7. Which of the following functions is used to retrieve the error message associated with the most recent database operation in PHP?

mysql_error()

mysqli_error()

pdo_error()

None of the above


8. Which of the following functions is used to retrieve information about the most recent query performed on the database connection in PHP?

mysqli_info()

mysql_info()

pdo_info()

None of the above


9. Which of the following functions is used to commit a transaction in PHP?

mysqli_commit()

mysql_commit()

pdo_commit()

None of the above


10. Which of the following functions is used to retrieve the current character set for the database connection in PHP?

mysqli_character_set_name()

mysql_character_set_name()

pdo_character_set_name()

None of the above