menu

PHP Database Connection


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

mysqli_begin()

mysql_begin()

pdo_begin()

None of the above


2. the following functions is used to escape special characters in a string for use in an SQL statement in PHP?

mysqli_real_escape_string()

mysql_real_escape_string()

pdo_real_escape_string()

None of the above


3. What is the function used to establish a connection to a MySQL database in PHP?

my_sqli_connect()

mysql_connect()

pdo_connect()

mysqli_connect()


4. Which of the following functions is used to fetch a row from a result set in PHP?

mysqli_get_row()

mysql_fetch_row()

pdo_fetch_row()

mysqli_fetch_row()


5. Which of the following functions is used to fetch an associative array from a result set in PHP?

mysqli_fetch_assoc()

mysql_fetch_assoc()

pdo_fetch_assoc()

None of the above


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

mysqli_query()

mysql_query()

pdo_query()

None of the above


7. 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()


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

mysqli_rollback()

mysql_rollback()

pdo_rollback()

None of the above


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

pdo_set_charset()

mysql_set_charset()

mysqli_set_charset()

None of the above


10. 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