[FX.php List] Works in FX.php v4.2, breaks in v6
Andrew Denman
adenman at tmea.org
Thu Dec 19 10:39:15 MST 2013
It still applies, but only for FileMaker generated errors. The error you are encountering is happening at the web server level, which returns an FX error object. Here's my error trapping code to catch both cases:
// See if there's an error
if(FX::isError($ReturnedData) || $ReturnedData['errorCode'] != 0 ){
if(FX::isError($ReturnedData)){
$errorMsg = "The server may be down.<br>";
$errorMsg .= $EnterData->getMessage();
}else{
require_once($_SERVER['DOCUMENT_ROOT'] . '\includes\FX\FMErrors.php'); //$errorsList is error array name
$errorMsg = $errorsList[$ReturnedData['errorCode']];
}
}else{
//OK!
}
Andrew Denman
From: fx.php_list-bounces at mail.iviking.org [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of LELAND LONG
Sent: Thursday, December 19, 2013 11:33 AM
To: fx.php_list at mail.iviking.org
Subject: Re: [FX.php List] Works in FX.php v4.2, breaks in v6
Dale, it does help thank you.
According to the documentation included with the current FX.php v6 build, FXDataFormat.pdf, page 1:
"Conventions used:
+ $ReturnedData is used to signify the array containing the data returned by a query...."
and page 3:
"echo $ReturnedData['errorCode']; ...."
So, am I to assume that this documentation is now depreciated and no longer applies? Oversight perhaps? Newer documentation available?
Leland Long
On Dec 19, 2013, at 11:33 AM, fx.php_list-request at mail.iviking.org<mailto:fx.php_list-request at mail.iviking.org> wrote:
Aha! Yes, the result of a failed query is a PHP object, not an array. So you'll need to trap whether $newSheetResult is an object or not before you try to reference its contents. I do this be evaluating my result:
if (is_object($newSheetResult))
{
// There is an error; proceed accordingly.
}
else
{
//The query produced results; proceed accordingly.
}
I believe in the case that $newSheetResult is an error, the error code can be referenced like this:
$newSheetResult->code
Hope this helps,
Dale
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20131219/f38f3642/attachment.html
More information about the FX.php_List
mailing list