Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
string sqlanywhere_error( [ resource link_identifier ] )
不建议使用此函数。应改用 sasql_error 函数。请参见sasql_error。
返回最近执行的 SQL Anywhere PHP 函数的错误文本。错误消息按连接进行存储。如果未指定 link_identifier,则 sqlanywhere_error 返回没有可用连接的最后一条错误消息。例如,如果您调用 sqlanywhere_connect,但连接失败,则可调用不含 link_identifier 参数的 sqlanywhere_error 以获取错误消息。如果要获取相应的 SQL Anywhere 错误代码值,请使用 sqlanywhere_errorcode 函数。
link_identifier sqlanywhere_connect 或 sqlanywhere_pconnect 返回的链接标识符。
描述错误的字符串。
本示例试图从不存在的表中进行选择。sqlanywhere_query 函数返回 FALSE,sqlanywhere_error 函数返回错误消息。
$result = sqlanywhere_query( $conn, "SELECT * FROM table_that_does_not_exist" ); if( ! $result ) { $error_msg = sqlanywhere_error( $conn ); echo "Query failed. Reason: $error_msg"; }