Hi, I have a array that looks like this
Array
(
[provider] => Array
(
[id] => provider1
[distribuitor] => Array
(
[0] => Array
(
[name] => distribuitor1
[machines] => Array
(
[0] => Array
(
[id] => MX3
[installDate] => 2009-01-01
)
[1] => Array
(
[id] => MX4
[installDate] => 2008-01-01
)
[2] => Array
(
[id] => MX7
[installDate] => 2009-05-05
)
)
)
[1] => Array
(
[name] => distribuitor2
[machines] => Array
(
[0] => Array
(
[id] => FX3
[installDate] => 2009-11-15
)
[1] => Array
(
[id] => GX4
[installDate] => 2008-07-22
)
[2] => Array
(
[id] => RX7
[installDate] => 2009-06-25
)
)
)
)
)
)
from this array I want to generate a series of sql statements like this:
INSERT INTO table1 VALUES ('provider1','distrubuitor1','MX3','2009-01-01')
INSERT INTO table1 VALUES ('provider1','distrubuitor1','MX4','2008-01-01')
INSERT INTO table1 VALUES ('provider1','distrubuitor1','MX7','2009-05-05')
INSERT INTO table1 VALUES ('provider1','distrubuitor2','FX3','2009-11-15')
INSERT INTO table1 VALUES ('provider1','distrubuitor2','GX4','2008-07-22')
INSERT INTO table1 VALUES ('provider1','distrubuitor2','RX7','2009-06-25')
I'm not really well versed on array manipulations so my question is: how can I achieve this?
Bonus Point:
If you can provide links to resources where i can learn more about this things.
The answer should work preferably with 'unlimited' nested arrays.
P.D.
I'm not a native English speaker, I know the title of my question should be more
generic, if you have a better title, please change it.