Ok I have a problem, which is not easy to put a title on. I am trying to get all the rows from column A where id = something. Below is an example of how the database looks:
id_1 id_2
-------------------
7 13
14 43
14 44
14 45
12 43
12 44
18 46
I need to get all items from id_2 and put them in an array depending on their id_1 id. In short I need to get this result from this database:
7 => 13
14 => 43,44,45
12 => 43,44
18 => 46
Sorry this seems confusing. I have tried GROUP BY, placing the mysql query in a for loop. I have about 1402 of these rows in this table. ANY HELP would be so greatly appreciated.
You need to use the group_concat mysql function for this. for example
That should give you what you’re looking for 🙂