Thanks Derrel, I'm not sure to understand all you said because I'm not an
expert of PHP and Javascript languages anyway I'll give a look at PHP object
to find the relation between an key indexed array and a PHP object.
Of course if I find a solution, I'll publish it through the forum, also I'll
give some tips for people like me who are looking for a good client side
framework.

Actually, I didn't want to use real number indexes as I wanted to separate
client and server side in the management of data arrays in javascript and
PHP programs. 

I have just seen that such a behaviour is working perfectly from PHP to
javascript in using rpc. I was using a record generated by mysql request :

mysql_connect ($host, $user, $password);
$result = mysql_db_query ("database","select user_id, fullname from table");
$row = mysql_fetch_array ($result));

PHP array $row contains something like :

$row["user_id"] and $row["fullname"]

then in the rpc command : res = rpc.callSync("saveData", "table");

javascript array res["user_id"] and res["fullname"] exists and contains the
same values as the PHP $row variable at return ...

and I'm looking to do the same but in starting from javascript to PHP now !


Thanks for your help and the really good work at qooxdoo.
Cheers
Eric


Derrell.Lipman wrote:
> 
> ericson <[EMAIL PROTECTED]> writes:
> 
>> I'd like to pass an array with "keys" to a PHP file through RPC.
>>
>> var record=[value1,value2,...];
>> res = rpc.callSync("saveData", "mytable", record);
>>
>> it works well, but in fact I would like to retrieve in my PHP program an
>> array like :
>>
>> record ["field1"=>value1, "field2"=> value2, ...]
>>
>> How I can specify "field1", "field2", ... with record variable in the
>> javascript program, each time I tried something like {field1: value1},
>> ...
>> the PHP program receive an object ?!
> 
> If you're using the PHP backend provided with qooxdoo, then the results
> you're
> seeing are the intended results.  Javascript associative arrays are not
> supported in JSON-RPC, so you can pass either a standard array (with index
> starting at zero and incrementing by exactly one with each successive
> array
> element, i.e. no sparse arrays), or you can pass an object.  The array
> gets
> converted to a PHP array, and the object gets converted to a PHP object.
> 
> If you really need the object to be represented as an array, you should be
> able to do an easy conversion in your application.  You could also modify
> the
> PHP backend.  That's one of the benefits of open-source software. :-)
> 
> Cheers,
> 
> Derrell
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-pass-indexed-array-to-PHP-tf3133188.html#a8692126
Sent from the qooxdoo-devel mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to