mysql_error

string mysql_error([mysql link connection]) 

Gets the error message from the last MySQL operation.

Returns:

String on success; FALSE on error

Description:

mysql_error() returns the MySQL error message from the last MySQL function call that invoked a MySQL client routine. If no error occurred, an empty string ("") is returned.

Version:

PHP 3+, PHP 4+

See also:

To get the numeric error code from the last MySQL query:

mysql_errno() 

Example:

Determine whether a query succeeded and display an error message if it didn’t
 <?php // Included code that connects to a MySQL server and sets a default database // See the MySQL Functions chapter introduction for the source code for the file include ('mysql_connect.inc.php'); // Go insane and ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.