Vidyalelo
MySQL · Q699

MySQL

Programming · MySQL · question 699

Q699

What returns a string containing an error message?

A.
mysql_error()
Answer
B.
mysql_errno()
C.
mysql_sqlstate()
D.
mysql_close()

Answer: Option A

Solution

Answer: Option A
Solution:
This question asks about a function in MySQL that provides information about errors that occur during database operations.
Let's understand the options:
Option A: mysql_error()
This function returns a string containing the actual error message.
Option B: mysql_errno()
This function returns an integer representing the error number.
Option C: mysql_sqlstate()
This function returns a five-character SQLSTATE error code.
Option D: mysql_close()
This function closes a database connection and doesn't return an error message.
Therefore, the correct answer is Option A: mysql_error() because it specifically returns the error message as a string.