Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (Français) » SQL Anywhere Server - Programming » SQL Anywhere Data Access APIs » SQL Anywhere PHP API » SQL Anywhere PHP API reference » Deprecated PHP functions


sqlanywhere_error (deprecated)

string sqlanywhere_error( [ resource link_identifier ] )

This function is deprecated. You should use the following PHP function instead: sasql_error.

Returns the error text of the most recently executed SQL Anywhere PHP function. Error messages are stored per connection. If no link_identifier is specified, then sqlanywhere_error returns the last error message where no connection was available. For example, if you call sqlanywhere_connect and the connection fails, then call sqlanywhere_error with no parameter for link_identifier to get the error message. If you want to obtain the corresponding SQL Anywhere error code value, use the sqlanywhere_errorcode function.


link_identifier   A link identifier that was returned by sqlanywhere_connect or sqlanywhere_pconnect.


A string describing the error.


This example attempts to select from a table that does not exist. The sqlanywhere_query function returns FALSE and the sqlanywhere_error function returns the error message.

$result = sqlanywhere_query( $conn, "SELECT * FROM table_that_does_not_exist" );
if( ! $result ) {
      $error_msg = sqlanywhere_error( $conn );
      echo "Query failed. Reason: $error_msg";
Related functions