PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i want to build an array thats its data is :
name,id,tonn
the only 1 of the 3 values that can repeat on itself is the "tonn"
i can have data like :
name id tonn
sd 3 2
cd 1 2
we 443 55
qa 2311 2
and i want the array build based on the tonn as the main index of the array!!!
how can i do this?
1 more thing : i dont know i advance the "tonn" ' i only get it at run time
ordered by tonn - so the array keys (based on the tonn???) must be build at run timme!
thnaks in advance
peleg
your example has tonn as a one to many relationship to the other data in the result set. that's a very inefficient main index, as php will only allow unique indices in arrays. I'm confused as to what you are trying to accomplish.
sd 3 2
cd 1 2
we 443 55
qa 2311 2
will be :
array={2=>{{"sd",3},{"cd",1},{"qa",2311}},55=>{{"we",443}}}
bacuse in the end i wan to use this arrays in javascript!
so in that case i preffer to use $example["2"] and not $example[2]
beacuse if i have 2 and 55 i have between them 53 empty cells!!!!
so what do you say about it?
thnaks i nadvane
peleg