menu

PHP Database Connection


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


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


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


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


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


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


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


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

mysqli_query()

mysql_query()

pdo_query()

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 fetch an associative array from a result set in PHP?

mysqli_fetch_assoc()

mysql_fetch_assoc()

pdo_fetch_assoc()

None of the above