Modules/MTA-MySQL/mysql errno: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Added the return value type) |
||
Line 4: | Line 4: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
mysql_errno ( MySQLConnection handler ) | int mysql_errno ( MySQLConnection handler ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required arguments=== | ===Required arguments=== |
Revision as of 14:50, 13 January 2008
Returns the last error number of a MySQL connection.
Syntax
int mysql_errno ( MySQLConnection handler )
Required arguments
- handler: A valid MySQL link
Returns
The last error number, zero if nothing failed. Visit http://dev.mysql.com/doc/refman/5.0/en/error-handling.html for a list of error codes.
Example
Example 1: This example sends a query to the server and if it fails, shows the reason.
result = mysql_query(handler, "SELECT FROM table") -- We have a syntax error in the query if (not result) then -- The query failed outputDebugString("mysql_query failed: (" .. mysql_errno(handler) .. ") " .. mysql_error(handler)) -- Show the reason end
See also
- mysql_connect
- mysql_close
- mysql_errno
- mysql_error
- mysql_ping
- mysql_select_db
- mysql_escape_string
- mysql_affected_rows
- mysql_change_user
- mysql_get_character_set_info
- mysql_get_client_info
- mysql_get_client_version
- mysql_get_host_info
- mysql_get_proto_info
- mysql_get_server_info
- mysql_get_server_version
- mysql_hex_string
- mysql_info
- mysql_insert_id
- mysql_query
- mysql_unbuffered_query
- mysql_set_character_set
- mysql_stat
- mysql_warning_count