Examveda

Which of the following returns an SQLSTATE code?

A. mysql_error()

B. mysql_errno()

C. mysql_sqlstate()

D. mysql_close()

Answer: Option C

Solution (By Examveda Team)

This question is about how to get information about errors that happen when you're using MySQL.
Here's what each option does:
* Option A: mysql_error() - This function gives you a detailed human-readable description of the error that happened. It's good for understanding what went wrong in plain English.
* Option B: mysql_errno() - This function returns a numeric code that represents the error. It's useful for identifying specific error types.
* Option C: mysql_sqlstate() - This function gives you a five-character SQLSTATE code. This code is standardized across different databases, making it useful for consistent error handling.
* Option D: mysql_close() - This function closes the connection to the MySQL server. It doesn't give you any error information.
So, the answer is Option C: mysql_sqlstate() because it specifically returns an SQLSTATE code.

This Question Belongs to MySQL >> MySQL Miscellaneous

Join The Discussion

Related Questions on MySQL Miscellaneous