Hey guys/gals
I have a multidimensional array like the following that i need to turn into a comma delimited string to save in a mysql database.
Now thats not a problem, i use this function.PHP Code:userItems = [[0,2],[22,4],[32,2],[28,4],[88,2],[76,4],[13,9],[17,45]];
Now when i use that function it turn my multidimensional array into this stringPHP Code:function JoinUserItems() {
sendItems = userItems.join(",");
trace(sendItems);
}
for me to save to mysql.
Now the problem is how do i change it back to its original form as a multidimensional array.PHP Code:0,2,22,4,32,2,28,4,88,2,76,4,13,9,17,45
I tried this,
But im pretty sure it only make it a one dimensional array. But its crucial i have it as a multidimensional array.PHP Code:function SplitUserItems() {
t = sendItems.split(",");
trace(t);
for(i=0; i< t.length; i++) {
if(i%2) {
trace("odd");
}else{
recieveItems.push(t[i],t[i+1]);
trace("even");
}
}
trace(recieveItems);
}
Any thoughts?
Thanks in AdvancE


Reply With Quote
Please delete this thread.
