Good afternoon.
Currently I have a dynamic form where the person can add the following values:
Category | Contact Us | Description
What I do so far: I get each line ((int) Category / (string) Title / (String) Description) and I enter in my database taking the ID that it returns. The column "Category" contains fixed values in a droplist, and it may happen to have rows with the same category, I need to GROUP these repeating (or not) items in another array
An example:
Array ( [0] => Array ( [categoria] => 1 [titulo] => teste 1 [descricao] => teste 1 [id_no_banco] => 1 ) [1] => Array ( [categoria] => 2 [titulo] => teste 2 [descricao] => teste 2 [id_no_banco] => 2 ) [2] => Array ( [categoria] => 1 [titulo] => teste 3 [descricao] => teste 3 [id_no_banco] => 3 ) )
What I need is: whether to repeat or not, create a second array that looks like this:
Array ( [0] => Array ( [id_categoria] => 1 [ids_do_banco] => 1;3 ) [1] => Array ( [id_categoria] => 2 [ids_do_banco] => 2 ) )
Notice that the repeated categories of indexes 0 and 2 are "grouped" in the new array, and this is what I can not find a solution, can someone give me a light? Thank you