-
as3 -> php -> MySQL problem
I have a ton of information that I need to pass to a database using php and MySQL.
The problem I am having is when I use the following:
var saveVars:URLVariables = new URLVariables();
then save an array to the saveVars:
saveVars.ya = ya; //ya is an array
it puts each ya element in its own variable IE:
if there are 3 elements:
ya=element1&ya=element2&ya=element3
Is there a way to pass the array 'as is' to php? IE
ya=element1,element2,element3
??
Thanks,
Beyond Flash
Beyond Flash
Your one stop web shop
http://www.beyondflash.net
-
Option I
Actionscript Code:
var separator:String="|"; var saveVars:URLVariables = new URLVariables(); saveVars.prop="VAR1"; saveVars.prop+=separator+"VAR2"; saveVars.prop+=separator+"VAR3"; saveVars.prop+=separator+"VAR4";
trace(saveVars.prop); trace(saveVars.prop.split("|")); //PHP side you can do whatever you like, as I shown in here, in FLASH.
Option II
Actionscript Code:
var saveVars:URLVariables = new URLVariables(); saveVars.prop=new Array(); saveVars.prop.push("VAR1"); saveVars.prop.push("VAR2"); saveVars.prop.push("VAR3"); saveVars.prop.push("VAR4");
trace(saveVars.prop); //PHP side you can do whatever you like, as I shown in here, in FLASH.
marlopax
Last edited by marlopax; 10-15-2011 at 03:27 AM.
-
reply
That isn't quite what I am looking for.
The variables already are in an array.
Want I want to do is pass the entire array to the php so I can insert them into the database as it.
In other words if there is an array in flash as so:
Actionscript Code:
var myArray = new Array(); myArray = 2,3,4,5,5,6; trace(myArray);
The output is:
2,3,4,5,5,6
I want to take that array and put it into a MySQL field as
2,3,4,5,5,6
Is this possible?
Beyond Flash
Your one stop web shop
http://www.beyondflash.net
-
What is in your php side and how do you setup the database?
And how do you want it back into flash?
marlopax
-
I am just receiving the posted variables and putting them into the database.
I have to keep the indexes in the correct spots because I have multiple variables which are arrays and not all array elements have data in them (some are undefined).
IE:
Actionscript Code:
var ya:Array = new Array( , , ,2, 5, 3, 2) var ya2:Array = new Array(2, ,4,2, ,)
I would like to post it to the PHP script like flash traces the array ie trace(ya)
I would also like to insert it into the ya field of the database the same way.
This way, when I bring it back into flash, I will be able to bring the array into flash like it was submitted.
Beyond Flash
Your one stop web shop
http://www.beyondflash.net
-
Actionscript Code:
var ya:Array = new Array( , , ,2, 5, 3, 2) var ya2:Array = new Array(2, ,4,2, ,)
How do you create this type of data in an Array? Are those are String? Or int?
What is the problem you are having right now? What Error or Warning you are having?
marlopax
-
The values in the array are ints
I am not getting any error messages.
When I attempt to post to the php script and it puts the data in the database, it only inserts the LAST element from the array.
Beyond Flash
Your one stop web shop
http://www.beyondflash.net
-
Post your PHP code and MySQL structure. including AS3 code.
arkitx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|