[FX.php List] Help with error message

Chris Hansen chris at iViking.org
Sat Oct 31 21:26:08 MDT 2015


Hey Jon,

Are you sure that XML sharing is enabled on FileMaker Server on your local machine?  Basically, the URL that you see there is (semi) equivalent of the request being made to FileMaker.  You should be able to click on that link and get back the XML that FileMaker outputs.  For some reason, the connection to your locally running FileMaker isn't working, and that's the bit that you need to debug.

At any rate, when you get an FX error object, it means that FX was never able to connect to the server for one reason or another.  Something that even experienced developers tend not to do, that they should be doing, is trap for errors.  So, that would look something like this:

// the rest of your query code would be above this
$qResult = $q->FMFind();
if (FX::isError($qResult)) {
    echo $qResult->getMessage();
}
elseif ($qResult[‘errorCode’] != 0) {
    echo "A FileMaker error occurred ({$qResult[‘errorCode’]})";
}
else {
    // your data set logic goes here
}

FYI, the curly braces inside the FileMaker error quotes help PHP to parse where the variable begins and ends.

HTH

--Chris

> On Oct 31, 2015, at 2:20 PM, Jon Montgomery <fxphp at igsmasouth.org <mailto:fxphp at igsmasouth.org>> wrote:
> 
> Ted,
> 
> Thank you for the tip.  I have read about the var_dump() but did not know why you would use it.  Here is what it said:
> 
> Accessing FileMaker Server 7+ data.
> 
> Using FileMaker URL: http://127.0.0.1:80/fmi/xml/FMPXMLRESULT.xml?-db=IGSMA_Membership.fmp12&-lay=login&-max=50&Login_ID=5501.1&Password=music4u&-find <http://127.0.0.1/fmi/xml/FMPXMLRESULT.xml?-db=IGSMA_Membership.fmp12&-lay=login&-max=50&Login_ID=5501.1&Password=music4u&-find>string(8) "$qResult”
> 
> 
> I also turned on DEBUG to get the url but it yields this:
> 
> Not Found
> 
> The requested URL /fmi/xml/FMPXMLRESULT.xml was not found on this server.
> 
> So what does this tell us?
> 
> 
> 
> Jon Montgomery, Illinois Grade School Music Assoicaiton - Southern Division
> www.igsmasouth.org <http://www.igsmasouth.org/>
> 
> 
> 
> On Oct 30, 2015, at 10:13 PM, Fitzgerald, Theodore C <ted-fitzgerald at uiowa.edu <mailto:ted-fitzgerald at uiowa.edu>> wrote:
> 
>> Jon,
>>  
>> Maybe you’ve already tried this, but I would suggest dumping out the contents of $qResult using var_dump($qResult); to see what type of object it is (the error message seems to indicate it’s an FX_Error object) and what data it is holding.  That will hopefully give you a bit more information about what is going on.
>>  
>> Ted
>>  
>> From: fx.php_list-bounces at mail.iviking.org <mailto:fx.php_list-bounces at mail.iviking.org> [mailto:fx.php_list-bounces at mail.iviking.org <mailto:fx.php_list-bounces at mail.iviking.org>] On Behalf Of Jon Montgomery
>> Sent: Friday, October 30, 2015 2:49 PM
>> To: fx.php_list at mail.iviking.org <mailto:fx.php_list at mail.iviking.org>
>> Subject: [FX.php List] Help with error message
>>  
>> Hi,
>>  
>> I am getting this error message and I have no idea how to fix it.  Your help would be very much welcomed:
>>  
>> Fatal error: Cannot use object of type FX_Error as array in /Library/WebServer/Documents/IGSMA/test/login_response.php on line 14
>>  
>> a few days ago working with Bob Patin at Longtermsolutions, who has hosted our FM7 (version 10) databases for many years, helped me with this and we were unable to get it to work on my laptop.  So he loaded it up on one of his FM servers and it all works great.  
>>  
>> Now, on my MacBook Pro, (Mavericks, FMS14 and FX.PHP) I cannot get this to work.  I have done various un-installs and re-installs of FMS14 and also PHP.  PHP is running, however I am getting this error. 
>>  
>> Anybody have a clue what I have done to my machine that is causing this?  For the record, work for years with FMStudio and know it’s downfall and am converting to straight “roll your own” FX.PHP.  But it all worked with FM version 10.  
>>  
>> Here is the code and the offending “Line 14" is marked.
>>  
>> <?php
>> include_once('FX/FX.php');
>> include_once('FX/server_data.php');
>>  
>> $Login_ID = $_POST['Login_ID'];
>> $PW = $_POST['Password'];
>>  
>> $q =new FX($serverIP,$webCompanionPort, $dataSourceType, $scheme);
>> $q->SetDBData('IGSMA_Membership.fmp12','login');
>> $q->SetDBPassword($webPW,$webUN);
>> $q->AddDBParam('Login_ID',$Login_ID);
>> $q->AddDBParam('Password',$PW);
>> $qResult = $q->FMFind();
>> echo $qResult[‘errorCode’];  //this is the line referred to in the error message in Chrome
>>  
>>  
>>  
>> Jon Montgomery, Illinois Grade School Music Assoicaiton - Southern Division
>> www.igsmasouth.org <http://www.igsmasouth.org/>_______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org <mailto:FX.php_List at mail.iviking.org>
>> http://www.iviking.org/mailman/listinfo/fx.php_list <http://www.iviking.org/mailman/listinfo/fx.php_list>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org <mailto:FX.php_List at mail.iviking.org>
> http://www.iviking.org/mailman/listinfo/fx.php_list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20151031/8b664cd5/attachment.html


More information about the FX.php_List mailing list