I am struggling with this for some reason.
I have 2 arrays. The first is a standard array called colsArray that looks like this:
Array
(
[0] => fName
[1] => lName
[2] => city
)
The second is a multidimensional array called query_data that looks like this:
Array
(
[0] => Array
(
[recordID] => xxx
[fName] => xxx
[lName] => xxx
[address1] => xxx
[city] => xx
[zip] => xxx
[vin] => xxx
)
[1] => Array
(
[recordID] => xxx
[fName] => xxx
[lName] => xxx
[address1] => xxx
[city] => xxx
[zip] => xxx
[vin] => xxx
)
[2] => Array
(
[recordID] => xxx
[fName] => xxx
[lName] => xxx
[address1] => xxx
[city] => xxx
[zip] => xxx
[vin] => xxx
)
[3] => Array
(
[recordID] => xxx
[fName] => xxx
[lName] => xxx
[address1] => xxx
[city] => xxx
[zip] => xxx
[vin] => xxx
)
)
I just need to use those 2 arrays to create a new array that has all the data from the query_data array where the keys are in the fist array colsArray. The new array would look like this:
Array
(
[0] => Array
(
[fName] => xxx
[lName] => xxx
[city] => xx
)
[1] => Array
(
[fName] => xxx
[lName] => xxx
[city] => xx
)
[2] => Array
(
[fName] => xxx
[lName] => xxx
[city] => xx
)
[3] => Array
(
[fName] => xxx
[lName] => xxx
[city] => xx
)
)
Any help on this would be great.
Thanks!