[FX.php List] fmdelete returns a 1

Chris Hansen chris at iViking.org
Thu Oct 22 10:26:17 MDT 2009


Dale,

While that would work, I'd use that in addition to FX::isError(), and  
not as a replacement.  After all, the built in function also tests  
whether the variable in question is an object, but also checks whether  
it's a specific TYPE of object (an FX error, or a subclass  
thereof...)  If you're getting some other sort of object back, that's  
a bigger problem.

--Chris

On Oct 22, 2009, at 8:51 AM, Dale Bengston wrote:

> Chris & William,
>
> I evaluate every return from FX with isObject(), since errors  
> generate objects and successes don't. This is an easy way to trap  
> errors and act accordingly.
>
> Dale
>
>
> On Oct 22, 2009, at 9:27 AM, Chris Hansen wrote:
>
>> William,
>>
>> Right.  No data to return.  There are a couple of ways to check for  
>> errors however, and you should probably check both:
>>
>> 1) FX::isError() -- which you pass your returned data.  This checks  
>> to ensure that no internal errors occurred (unable to contact  
>> FileMaker, etc.
>>
>> then, as long as the above returns false, you can check:
>>
>> 2) $myQuery->lastErrorCode -- where $myQuery is the FX query object  
>> that you just used to perform a deletion.  Basically, this is the  
>> same as the errorCode that you're familiar with, but stored as part  
>> of the FX object =)
>>
>> Let me know if you have related questions, etc.  HTH
>>
>> --Chris
>>
>> On Oct 22, 2009, at 8: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
>>>
>>> I am unable to investigate afterwards for  errorCode == 0  
>>> afterwards - presumably because there is no data to return -
>>>
>>> How dow I show the user that the deletion was successful ?
>>>
>>> Do I need to use something like  is_array (or whatever the  
>>> opposite is ?)
>>>
>>> Kindest Regards
>>>
>>> William
>>> _______________________________________________
>>> 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