Welcome Guest, Not a member yet? Register   Sign In
Adding Data to a MultiDimensional Array...
#1

(This post was last modified: 07-16-2018, 07:30 PM by ryan_f.)

Hey there---

I'm looking for help on how to do this...

I have the following array:
Array ( 
[0] => Array ( 
[ID] =>123
[Car] => Honda 
[Make] => Accord 
[Color] => White 

[1] => Array ( 
[ID] =>654
[Car] => Toyota 
[Make] => Camry
[Color] => Black 

[2] => Array ( 
[ID] =>789
[Car] => Nissan 
[Make] => Altima
[Color] => Red 

)

All in this variable:
$data['get_cars'] = $car_query->result_array();


Then I do a foreach with the IDs to grab the years...
Year of Honda with ID 123 is 2008
Year of Toyota with ID 654 is 2010
Year of Nissan with ID 789 is 2014

Now i have an array like this:
Array ( 
[0] => Array ( 
[Year] =>2010

[0] => Array ( 
[Year] =>2012

[0] => Array ( 
[Year] =>2015

)
How do I do this so I can add this to my original multidimensional array?
Reply


Messages In This Thread
Adding Data to a MultiDimensional Array... - by ryan_f - 07-16-2018, 07:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB