I’m posting data from a form with multiple fields. One form needs to send several rows to mySQL, ie.
Row1 -> Field1 Field2 Field3 Field4
Row2 -> Field1 Field2 Field3 Field4
etc...
I’ve created an array of arrays in the following format:
Array (
[0] => Array (
[0] => Field1
[1] => Field1 )
[1] => Array (
[0] => Field2
[1] => Field2 )
)
I can’t figure out how to reorder them so I can loop through and insert them into my database. I need them to be
Array (
[0] => Array (
[0] => Field1
[1] => Field2 )
[1] => Array (
[0] => Field1
[1] => Field2 )
)
What’s the best way to do this?
Basically, it’s like flipping the matrix 90 degrees (sorry, don’t know the proper term). I could not find any built-in function, so here it is — this will work with ANY number of rows & columns (test data included).