Last time I made a data driven app with AMFPHP. I used PHP and MySQL.  I did
all of what your describing within PHP and MySQL.

Everytime I querried the database, I always sent back the same kind of
object to Flex.  The object always had two properties, a Œsuccess¹ property
and a Œmessage¹ property. IF the query succeeded, then my object that I
created in PHP would be:

Œsuccess¹ = true; Œmessage¹ = query executed successfully.

Or if it failed it would be.

Œsuccess¹ = false; Œmessage¹ = [enter your custom error message here. I.e.
Œrecord already exists¹]

 I suggest making your remote object responses in a format that you repeat,
like this:

<mx:RemoteObject id="myRemoteObject">
     <mx: method name ="insertRecord" result
=¹_onInsertRecordResponse(event)"/>
<mx:RemoteObject/>


private function _onInsertRecordResponse (evt:ResultEvent) : void
 {

    if(evt.result.success) // remember I¹m returning an object with a
Œsuccess¹ and a Œmessage¹
    {
        Alert.show(event.result.message) // output Œquery execurted
seccessfully¹
    } 
    Else if (!evt.result.success)
    {
        Alert.show(event.result.message) // outputs Œrecord already exists¹
// my custom error message I made in PHP
    }
}

This way, every result handler, from every remote object is in my app is
structured the same way.

Alan

Reply via email to