Here is my nested foreach loop to get the data from database
while($attrib_rec = tep_db_fetch_array($attributes)) {
foreach( $options_values as $option => $options_value ){
foreach( $options_value as $options_value_key => $each_value ){
//make separate arrays of "option"
print 'option = '.$option.' , value = '.$each_value.'<br />';
}
}
}
The output I am getting from these loops is
option = Type , value = GOLD
option = Type , value = SILVER
option = Type , value = BRONZE
option = Purity , value = Rough
option = Purity , value = Neat
option = Purity , value = Mixed
option = Purity , value = Random
option = Model , value = Old
option = Model , value = latest
option = Model , value = GOLD 1.0
option = Model , value = GOLD 1.1
option = Model , value = GOLD 1.2
option = Model , value = GOLD 1.3
what I want to achieve is to save every same "option" value an array. e.g from the above output I should get 3 arrays. i.e
$type = array('GOLD', 'SILVER', 'BRONZE');
$purity = array('Rough', 'Neat', 'mixed', 'Random');
$model = array('Old', 'Latest', 'GOLD 1.0', 'GOLD 1.1', 'GOLD 1.2', 'GOLD 1.3');
on each iteration of while loop it should make number of arrays according to "options".
If first time it makes 3 arrays(as in this example) on next iteration of while loop it might make 2 or 4 arrays depending on the same number of "Option" I get from DB.
foreachloop which will show to the output like it is showing it... you can use filter orgroup by