0
Good afternoon.
Currently I have a dynamic form where the person can add the following values:
Category | Title | Description
What I do so far: I take each line ((int) Category/ (string) Title / (String) Description) and insert it into my database by taking the ID it returns. The "Category" column contains fixed values in a droplist, and there may be lines with the same category, I need to GROUP these repeated items (or not) 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 index 0 and 2 are "grouped" in the new array, and this is what I’m not finding a solution for, can someone give me a light? thank you
That’s exactly what I needed, I broke my head so much for something relatively simple, thank you very much!
– Everton Neri