PHP is a loosely typed language and doesn't really implement a strictly boolean 
type. Generally, PHP will convert this to an int with 0 being false and 
anything else being true (Normally set to 1).

What I have noticed is that sending a (so called) false value from PHP to Flex 
sends the string "0" which actually evaluates to true (A non empty string is 
true to all intents and purposes).

So, what to do?

I manually convert my boolean variables to strings for my flex value objects 
and check their values on the PHP side.



HTH.


Steve

--- In [email protected], "secrit.service" <secrit-serv...@...> wrote:
>
> 
> Hello,
> 
> I have following situation:
> 
> a mySQL-database with a table containing 3 fields :
>       - ID : INTEGER : AUTO INC
>       - description : VARCHAR(100)
>       - flaggedForDeletion : TINYINT(1)
> 
> Some of the records are :
>       1     This is a test               0
>       2     This is also a test     0
> 
> 
> I created a valueObject Record :
>       var recordID:Integer;
>       var recordDescription:String;
>       var flaggedForDeletion:Boolean;
> 
> 
> When starting my Flex application I get all records from the database
> and add them into an ArrayCollection, which acts as dataprovider for a 
> datagrid. By dragging a record from the datagrid to a recyclebin, I want
> to update the record, meaning setting flaggedForDeletion = 1.
> Therefore I created a variable recordToUpdate of type Record and map all
> fields of the datagridrecord to the appropriate variable of
> recordToUpdate.
> Using my remoteObject myRO.UPDATE_RECORD.send(recordToUpdate) the
> request will be handled on serverside by a PHP-script :
> 
> function updateRecord ($pNewRecord) {
>     $strSQL = "UPDATE tblRecords" .
>                          "SET description =
> '".$pNewRecord[recordDescription]."', ".
>                                   "flaggedForDeletion =
> ".$pNewRecord[flaggedForDeletion]." ".
>                          "WHERE ID = ".$pNewRecord[recordID];
> 
>     return $strSQL;
> }
> 
> The query is not executed, and when I return my SQL-string, it tells me
> that the value for flaggedForDeletion does not contain any value.
> 
> When I debug my application, the values of my
> recordToUpdate.flaggedForDeletion seem to be OK.
> 
> Anyone has any idea what I do wrong?
> 
> Thanks
>


Reply via email to