menu

PHP Database Connection

PHP Database Connection - Important Points


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

A. mysqli_real_escape_string()

B. mysql_real_escape_string()

C. pdo_real_escape_string()

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

mysqli_real_escape_string() function is used to escape special characters in a string for use in an SQL statement in PHP.

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

A. mysqli_begin()

B. mysql_begin()

C. pdo_begin()

D. None of the above

Discuss Work Space

Answer: option d

Explanation:

Transactions are not supported by all database drivers, and therefore, there is no universal function to begin a transaction in PHP.

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

A. mysqli_commit()

B. mysql_commit()

C. pdo_commit()

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

mysqli_commit() function is used to commit a transaction in PHP.

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

A. mysqli_rollback()

B. mysql_rollback()

C. pdo_rollback()

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

mysqli_rollback() function is used to roll back a transaction in PHP.

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

A. mysqli_info()

B. mysql_info()

C. pdo_info()

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

mysqli_info() function is used to retrieve information about the most recent query performed on the database connection in PHP.


Subscribe for Latest Career Trends
Subscribe Now
Use AI and ChatGPT for Career Guidance

Unlock Your Future

Join Now
Worried for Placements in 2024?

Join FAST TRACK Course

Join Now
Supercharge Your SUCCESS

Join All in One Placement Mock Tests-2024

Join Now