ads_error

Advantage PHP Extension

  Previous topic Next topic  

Returns the last Advantage error code.

Syntax

string ads_error( [int connection_id] )

Parameters

connection_id (I)

Optional ID of a connection to the Advantage Database Server.

Remarks

ads_error returns an error code if an error occurred or an empty string if no error occurred in last Advantage API that was performed. If a connection ID is not specified, the last error of any connection is returned.

Example

<?

echo "Connecting to a Server that does not exist.<br>\n";

echo "This connect should FAIL!<br>\n";

$rConn = ads_connect( "DataDirectory=\\\\NOServer\\NonExistantShare\\;ServerTypes=2", "", "" );

 

if ( $rConn == False )

{

$strErrCode = ads_error( );

$strErrString = ads_errormsg( );

echo "Connection failed: " . $strErrCode . " " . $strErrString . "<br>\n";

}

else

{

echo "Connection successful!<br>\n";

ads_close( $rConn );

echo "Connection closed<br>\n";

}

?>

See Also

ads_connect

ads_errormsg