need help grouping a array
Posted by smarty-boots, 10-24-2012, 10:57 AM Hi I have this as a array: and I need to group it like this (there is 600+ in the over all array): can anyone help me out please? but when I try this: all I get is the last out put and this error: Warning: Invalid argument supplied for foreach() Last edited by smarty-boots; 10-24-2012 at 11:04 AM.
Posted by zoid, 10-24-2012, 01:51 PM Can you correct your array code? It is not valid PHP code.
Posted by Herasil, 10-24-2012, 02:25 PM PHP array guide: http://www.w3schools.com/php/func_array.asp Is this what you wanted your $sets variable to look like? The one you provided has many errors. However, this would cause an error in your foreach loop, because the nested foreach loop assumes that $records is also an array, but just "B" is not an array, hence the "Invalid argument supplied for foreach()" warning you got. You could fix this by changing $sets to: