I'm pulling this data from a mysql table and then creating the array based on the row data (ie :
Code: Select all
//....
while($row=mysql_fetch_assoc($sql) {
$MyArray[] = $row;
}
//....$MyArray
Code: Select all
Array
(
ї0] => Array
(
їvehicle_type] => truck
їmanufacturer] => Toyota
їyear] => 2004
)
ї1] => Array
(
їvehicle_type] => Car
їmanufacturer] => Nissan
їyear] => 1998
)
ї2] => Array
(
їvehicle_type] => Car
їmanufacturer] => Nissan
їyear] => 2000
)
ї3] => Array
(
їvehicle_type] => Car
їmanufacturer] => Ford
їyear] => 2005
)
)So, the resulting array would look something like this :
Code: Select all
Array
(
ї0] => Array
(
їvehicle_type] => truck
їmanufacturer] => Toyota
їyear] => 2004
)
ї1] => Array
(
їvehicle_type] => Car
їmanufacturer] => Nissan
їyear] => 1998, 2000
)
ї2] => Array
(
їvehicle_type] => Car
їmanufacturer] => Ford
їyear] => 2005
)
)See what I mean? I've busted my damn brain on trying to figure this out. Can anyone help out? Thanks.
Again, what i'm trying to accomplish is loop through the numerical index of the array (0,1,2,3,...). While i'm looping through the index, I want to say "Ok, if the next 5 indexes all have the EXACT SAME vehicle_type, then search to see if the MANUFACTURER is the EXACT same. If we Find duplicate manufacturers, then combine all their YEAR values into one big value seperated by commas, otherwise, continue with the script.