fm_get_last_error


mixed fm_get_last_error ( [ int $selector ] ) 


 

Description


Allows you to check for an error returned by one of the “fm” functions or for an error that’s been set using fm_set_error.

If you call this function with no parameter, both the error number and the error message will be returned.

 

Parameters


selector (optional)

Pass in 1 to return only the error number or 2 to return only the error message. If a FileMaker error causes the error (for example when using fm_evaluate), you can get the FileMaker error number by passing in a 3.

 

Return


Returns the last error which will be 0 if there’s no error.


Errors


There are no errors for this function.

 

Example 1 - Get error number and message
fm_set_error(1000, 'An unexpected error has occurred, try again and good luck!');
echo fm_get_last_error();
/*
Returns: 1000 An unexpected error has occurred, try again and good luck!
*/
Example 2 - Get error number only
fm_set_error(1000, 'An unexpected error has occurred, try again and good luck!');
echo fm_get_last_error(1);
/*
Returns: 1000
*/