How to insert the database elements from an array?
Hello, please tell me. Should I have the task. You need to insert in database values, I have 5 multidimensional arrays, and each array element must be inserted in a separate column in the database, please tell me how can I do that?
Structure of arrays like this. Thank you in advance for the answer
Array
(
[0] => Array
(
[0] => 100.00
[1] => 2100.00
[2] => 4100.00
[3] => 6600.00
[4] => 8600.00
[5] => 10500.00
)
[1] => Array
(
[0] => 100.00
[1] => 2095.00
[2] => 4095.00
[3] => 6600.00
[4] => 8605.00
[5] => 10500.00
)
[2] => Array
(
[0] => 95.00
[1] => 2105.00
[2] => 4095.00
[3] => 6600.00
[4] => 8595.00
[5] => 10500.00
)
[3] => Array
(
[0] => 4.0
[1] => 3.5
[2] => 1.0
[3] => 2.0
[4] => 5.0
[5] => 1.5
)
[4] => Array
(
[0] => 1.5
[1] => 1.5
[2] => 1.5
[3] => 1.5
[4] => 1.5
[5] => 1.5
)
[5] => Array
(
[0] => -1.5
[1] => -6.0
[2] => -3.5
[3] => 0.5
[4] => 2.5
[5] => 1.0
)
[6] => Array
(
[0] => -4.0
[1] => 6.0
[2] => -4.0
[3] => 1.0
[4] => -4.0
[5] => 1.0
)
[7] => Array
(
[0] => 2.50
[1] => 2.50
[2] => 5.00
[3] => 5.00
[4] => 5.00
[5] => 7.50
)
)
1 answer
1. to loop arrays
2. to form INSERT query using c iterations of the loop
3. to execute a query tool through which You work with the database
Find more questions by tags MySQLPHP