menu

PHP Database Connection


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


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


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


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


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


6. Which of the following functions is used to select a database in PHP?

my_sqli_select_db()

mysql_select_db()

pdo_select_db()

mysqli_select_db()


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

mysqli_commit()

mysql_commit()

pdo_commit()

None of the above


8. Which of the following functions is used to free up memory associated with a result set in PHP?

pdo_free_result()

mysql_free_result()

mysqli_free_result()

None of the above


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


10. Which of the following functions is used to close a database connection in PHP?

mysqli_close()

mysql_close()

pdo_close()

None of the above