===== Syntax =====
int mysql_errno([resource $res])
//(PHP 4, PHP 5)//
^ $res | The database connection resource that we want to use. |
^ RETURNS | MySQL-specific error code generated by the last database query. |
===== What it Does =====
Returns the error code for the last ''MySQL'' error generated. [[mysql_query]] function will return //false// if an error occurred. You can check for this when running your query and use **mysql_errno** to get the error code. If the optional parameter **$res** is left out, the function will use the last database resource opened by the script.
===== Example =====
// open the mysql resource
$res = mysql_connect($server, $user, $pass);
// insert a single row into tblState
if (!mysql_query('INSERT * INTO tblState (\'California\')', $res)) {
// get the error number
$errno = mysql_errno($res);
}