[FX.php List] Re: FX.php_List Digest, Vol 114, Issue 14
Ness, David
dness at bondedbuilders.com
Wed Mar 19 15:08:08 MDT 2014
Thanks for taking the time to share.
I'll look at all of this and implement the changes you've highlighted. I'll let you know the results.
David Ness
FileMaker & Web Applications Developer
Bonded Builders Warranty Group
800-749-0381 x3123
From: fx.php_list-bounces at mail.iviking.org [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of LELAND LONG
Sent: Wednesday, March 19, 2014 4:46 PM
To: fx.php_list at mail.iviking.org
Subject: [FX.php List] Re: FX.php_List Digest, Vol 114, Issue 14
I think you may be experiencing the same pain I did when moving from FX v4.x to v6.x.
What I found in this forum is that the amount of pain you feel when doing this conversion is based solely upon you're programming style (how you implemented the FX functions on your page). Some people have expressed no pain in converting but I think their coding and the way they use the FX functions are different than mine and therefore our experiences differ.
Looking at the code example you provided I am going to offer code snippets that I changed in my code that eliminated this error for me, in the hopes that it can aid you in determining the source of your error. I will bold the code that changed.
Original code:
include_once('FX/FX.php');
include_once('FX/FMErrors.php');
include_once('FX/server_data.php');
$search1=new FX($server,$webCompanionPort);
$search1->SetDBData('MyDatabase.fmp12', 'FX_Portal_Report', 'all');
$search1->AddDBParam('SalesPOno', $criteria);
$search1Result=$search1->FMFind();
if (($search1Result->code <> 0) && ($search1Result->code <> 401)) {
echo ('FX_FMS_Error\n');
Exit;
}
foreach($search1Result['data'] as $key=>$search1Data) {
$theData=$search1Data['myField'][0];
echo '<databaseData>'.$theData.'</databaseData >';
}
Modified code:
include_once('FX/FX.php');
include_once('FX/FX_Error.php');
include_once('FX/server_data.php');
$search1=new FX($server,$webCompanionPort);
$search1->SetDBData('MyDatabase.fmp12', 'FX_Portal_Report', 'all');
$search1->SetDBPassword('myPW', 'myUN');
$search1->AddDBParam('SalesPOno', $criteria);
$search1Result=$search1->FMFind();
if (is_object($search1Result))
if (($search1Result->code <> 0) && ($search1Result->code <> 401)) {
echo ('FX_FMS_Error\n');
Exit;
}
foreach($search1Result['data'] as $key=>$search1Data) {
$theData=$search1Data['myField'][0];
echo '<databaseData>'.$theData.'</databaseData >';
}
Things to note on the modifications:
1) not sure of the internal changes but the filename had to be changed from FMErrors.php to FX_Error.php
2) I had to add the SetDBPassword function in order to not fail. I thought this was strange because my settings in the server_data.php file always worked before the upgrade. This is also a good example of what I meant in programming styles. Other developers may have already used this function in their code and therefore didn't require changes after upgrading.
3) the additional if() statement to test for an object was a solution offered to me by someone else on this list which helped me eliminate the "Cannot use object of type FX_Error as array" error that you are also experiencing. I suppose that this error could also be triggered in the foreach() block if you omit the Exit() function in the preceding if() statement.
Hope this helps.
Leland
On Mar 19, 2014, at 3:48 PM, fx.php_list-request at mail.iviking.org<mailto:fx.php_list-request at mail.iviking.org> wrote:
On Mar 19, 2014, at 2:37 PM, Ness, David <dness at bondedbuilders.com<mailto:dness at bondedbuilders.com>> wrote:
This is the result of the print_r($queryResult);
FX_Error Object ( [error_message_prefix] => [mode] =>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20140319/1ca3dd96/attachment.html
More information about the FX.php_List
mailing list