[FX.php List] fmdelete returns a 1

Chris Hansen chris at iViking.org
Tue Oct 27 10:05:12 MDT 2009


Dale,

Ah, sorry, wasn't paying attention to what I was coding...  Doh!  That  
line should be:

} elseif ($medLang->lastErrorCode != 0) {

Note that it's the FX object that stores that information, and NOT the  
result.  See if that doesn't work better for you.  Sorry about the  
confusion.  Best,

--Chris

On Oct 27, 2009, at 7:26 AM, Dale Bengston wrote:

> Chris,
>
> The second condition generates an error for me, since $result- 
> >lastErrorCode doesn't exist if a found set is returned. Do I have  
> to set a preference for $result->lastErrorCode to be generated by FX?
>
> Thanks,
> Dale
>
> On Oct 26, 2009, at 11:28 AM, Chris Hansen wrote:
>
>> William,
>>
>> Something like this:
>>
>> if( FX::isError( $medLangResult ) ) {
>>   echo "system error - please inform admin etc";
>> } elseif ($medLangResult->lastErrorCode != 0) {
>>   echo "error - please inform admin etc";
>> } else {
>>   // do non-error items
>> }
>>
>> Basically, there are two types of potential errors: a serious  
>> system error (e.g. FileMaker is down, eek!), or a FileMaker error  
>> (e.g. improper permissions, record locked, etc.)  Both types need  
>> to be trapped.  Make sense?
>>
>> --Chris
>>
>> On Oct 22, 2009, at 6:23 PM, william.downs wrote:
>>
>>> Chris, Tim, Dale
>>>
>>> many sincere thanks - all a great help.
>>>
>>> Chris - I get the bit about the error object - but the second part  
>>> eludes me :
>>>
>>> This is correct so far -
>>>
>>>  $medLang=new FX($serverIP,$webCompanionPort,'FMPro7');
>>>  $medLang->SetDBData($fmFile,'medLangs');
>>>  $medLang->SetDBPassword($webPassword,$webUser);
>>>  $medLang->AddDBParam('-recid',$recid);
>>>
>>>  $medLangResult=$medLang->FMDelete();
>>>
>>>  if( FX::isError( $medLangResult ) ) {
>>> echo "error - please inform admin etc";
>>>   }
>>>
>>> So what would I do with $medLangResult->lastErrorCode ?
>>>
>>> I will actually speak to the client about your point below Webko -  
>>> I like the idea.
>>>
>>> Kindest Regards
>>>
>>> William
>>>
>>> On 22 Oct 2009, at 21:40, Tim 'Webko' Booth wrote:
>>>
>>>>
>>>> On 23/10/2009, at 1:06 AM, william.downs wrote:
>>>>
>>>>> Hi there,
>>>>>
>>>>> after a stint with the fm API, I am back to FX.php :-)
>>>>>
>>>>> Using fmdelete to delete a record - which works fine (does  
>>>>> delete the record) - but
>>>>
>>>> As a side-note to the other answers - I don't allow a delete to  
>>>> be run from the web. All 'deleted' records are flagged as not to  
>>>> show in searches, and then checked by an admin later through FM.  
>>>> Learnt that people will always delete something they don't mean  
>>>> to...
>>>>
>>>> Cheers
>>>>
>>>> Webko
>>>>
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>



More information about the FX.php_List mailing list