array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'mysqli-sql-exception.getsqlstate.php', 1 => 'mysqli_sql_exception::getSqlState', 2 => 'Returns the SQLSTATE error code', ), 'up' => array ( 0 => 'class.mysqli-sql-exception.php', 1 => 'mysqli_sql_exception', ), 'prev' => array ( 0 => 'class.mysqli-sql-exception.php', 1 => 'mysqli_sql_exception', ), 'next' => array ( 0 => 'ref.mysqli.php', 1 => '别名和过时的 Mysqli 函数', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/mysqli/mysqli_sql_exception/getsqlstate.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

mysqli_sql_exception::getSqlState

(PHP 8 >= 8.1.2)

mysqli_sql_exception::getSqlStateReturns the SQLSTATE error code

说明

public mysqli_sql_exception::getSqlState(): string

Returns a string containing the SQLSTATE error code for the last error. The error code consists of five characters. The values are specified by ANSI SQL and ODBC. For a list of possible values, see » http://dev.mysql.com/doc/mysql/en/error-handling.html.

注意:

Note that not all MySQL errors are yet mapped to SQLSTATE's. The value HY000 (general error) is used for unmapped errors.

参数

此函数没有参数。

返回值

Returns a string containing the SQLSTATE error code for the last error. The error code consists of five characters.