The mysql query I do is returning a multi-dimensional array:
array
0 =>
array
'id' => string '177' (length=3)
'speelplein_id' => string '49' (length=2)
'type' => string '2' (length=1)
'naam' => string 'omgeving & zonering' (length=19)
'nummer' => null
'foto' => null
'created_dt' => string '2009-06-09 10:23:18' (length=19)
'edited_dt' => string '0000-00-00 00:00:00' (length=19)
'fabrikatietype' => null
'fabrikant' => null
'serienummer' => null
'bouwjaar' => null
'leverancier' => null
'opmerkingen' => null
'meubilair' => null
'klantNaam' => string 'Stad Kortrijk sector B' (length=22)
'speelpleinNaam' => string 'B1 Koolkappersstraat KR 503' (length=27)
'adres' => string 'Koolkapperstraat' (length=16)
'gemeente' => string 'Kortrijk' (length=8)
'postcode' => string '8500' (length=4)
'meldingId' => string '10716' (length=5)
'omschrijving' => string 'omheining te dicht bij de toestellen en draad op verschillende plaatsen los' (length=75)
'preventiemaatregel' => string 'draad verplaatsen' (length=17)
'meldingStatus' => string '2' (length=1)
'statusWijziging' => null
'inspectieType' => string '2' (length=1)
'inspectieId' => string '32' (length=2)
1 =>
array
'id' => string '177' (length=3)
'speelplein_id' => string '49' (length=2)
'type' => string '2' (length=1)
'naam' => string 'omgeving & zonering' (length=19)
'nummer' => null
'foto' => null
'created_dt' => string '2009-06-09 10:23:18' (length=19)
'edited_dt' => string '0000-00-00 00:00:00' (length=19)
'fabrikatietype' => null
'fabrikant' => null
'serienummer' => null
'bouwjaar' => null
'leverancier' => null
'opmerkingen' => null
'meubilair' => null
'klantNaam' => string 'Stad Kortrijk sector B' (length=22)
'speelpleinNaam' => string 'B1 Koolkappersstraat KR 503' (length=27)
'adres' => string 'Koolkapperstraat' (length=16)
'gemeente' => string 'Kortrijk' (length=8)
'postcode' => string '8500' (length=4)
'meldingId' => string '10717' (length=5)
'omschrijving' => string 'gegevens van de uitbater niet meer correct op het bord' (length=54)
'preventiemaatregel' => string 'gegevens/bord aanpassen' (length=23)
'meldingStatus' => string '2' (length=1)
'statusWijziging' => null
'inspectieType' => string '2' (length=1)
'inspectieId' => string '32' (length=2)
2 =>
array
'id' => string '178' (length=3)
'speelplein_id' => string '49' (length=2)
'type' => string '1' (length=1)
'naam' => string 'Schommel KR 503 04' (length=18)
'nummer' => string 'KR 503 04' (length=9)
'foto' => string '1243951714schommel.JPG' (length=22)
'created_dt' => string '2009-06-09 10:23:18' (length=19)
'edited_dt' => string '0000-00-00 00:00:00' (length=19)
'fabrikatietype' => string '' (length=0)
'fabrikant' => string 'JOAT' (length=4)
'serienummer' => string '' (length=0)
'bouwjaar' => string '0000' (length=4)
'leverancier' => string 'JOAT' (length=4)
'opmerkingen' => string '' (length=0)
'meubilair' => null
'klantNaam' => string 'Stad Kortrijk sector B' (length=22)
'speelpleinNaam' => string 'B1 Koolkappersstraat KR 503' (length=27)
'adres' => string 'Koolkapperstraat' (length=16)
'gemeente' => string 'Kortrijk' (length=8)
'postcode' => string '8500' (length=4)
'meldingId' => string '10718' (length=5)
'omschrijving' => string 'struikelgevaar aan de wortels' (length=29)
'preventiemaatregel' => string 'wortels verwijderen' (length=19)
'meldingStatus' => string '2' (length=1)
'statusWijziging' => null
'inspectieType' => string '2' (length=1)
'inspectieId' => string '32' (length=2)
3 =>
array
'id' => string '179' (length=3)
'speelplein_id' => string '49' (length=2)
'type' => string '1' (length=1)
'naam' => string 'Toren KR 503 01' (length=15)
'nummer' => string 'KR 503 01' (length=9)
'foto' => string '1243951834buizentoren.JPG' (length=25)
'created_dt' => string '2009-06-09 10:23:18' (length=19)
'edited_dt' => string '0000-00-00 00:00:00' (length=19)
'fabrikatietype' => string '' (length=0)
'fabrikant' => string 'Sinnesael' (length=9)
'serienummer' => string '' (length=0)
'bouwjaar' => string '0000' (length=4)
'leverancier' => string 'Sinnesael' (length=9)
'opmerkingen' => string '' (length=0)
'meubilair' => null
'klantNaam' => string 'Stad Kortrijk sector B' (length=22)
'speelpleinNaam' => string 'B1 Koolkappersstraat KR 503' (length=27)
'adres' => string 'Koolkapperstraat' (length=16)
'gemeente' => string 'Kortrijk' (length=8)
'postcode' => string '8500' (length=4)
'meldingId' => string '10719' (length=5)
'omschrijving' => string 'dakpanelen rot - beknelling aan ladder en net - geen instapbaar - vrije zone te klein rond het toestel' (length=102)
'preventiemaatregel' => string 'nodige panelen vervangen - beknellingen oplossen - vrije zones aanpassen' (length=72)
'meldingStatus' => string '2' (length=1)
'statusWijziging' => null
'inspectieType' => string '2' (length=1)
'inspectieId' => string '32' (length=2)
4 =>
array
'id' => string '180' (length=3)
'speelplein_id' => string '49' (length=2)
'type' => string '1' (length=1)
'naam' => string 'Veertoestel KR 503 02' (length=21)
'nummer' => string 'KR 503 02' (length=9)
'foto' => string '1243951964veertje auto.JPG' (length=26)
'created_dt' => string '2009-06-09 10:23:18' (length=19)
'edited_dt' => string '2009-06-10 15:54:21' (length=19)
'fabrikatietype' => string '' (length=0)
'fabrikant' => string 'Proludic' (length=8)
'serienummer' => string '' (length=0)
'bouwjaar' => string '0000' (length=4)
'leverancier' => string 'Marny' (length=5)
'opmerkingen' => string '' (length=0)
'meubilair' => null
'klantNaam' => string 'Stad Kortrijk sector B' (length=22)
'speelpleinNaam' => string 'B1 Koolkappersstraat KR 503' (length=27)
'adres' => string 'Koolkapperstraat' (length=16)
'gemeente' => string 'Kortrijk' (length=8)
'postcode' => string '8500' (length=4)
'meldingId' => string '10720' (length=5)
'omschrijving' => string 'onvoldoende vrije zone rond het toestel' (length=39)
'preventiemaatregel' => string 'vrije zone aanpassen' (length=20)
'meldingStatus' => string '2' (length=1)
'statusWijziging' => null
'inspectieType' => string '2' (length=1)
'inspectieId' => string '32' (length=2)
Now I want to group the array by 'id' and only retain the 'id' and 'naam' values. So as a result I should get something close to:
array
0 =>
array
'id' => string '177' (length=3)
'naam' => string 'omgeving & zonering' (length=19)
1 =>
array
'id' => string '178' (length=3)
'naam' => string 'Schommel KR 503 04' (length=18)
2 =>
array
'id' => string '179' (length=3)
'naam' => string 'Toren KR 503 01' (length=15)
3 =>
array
'id' => string '180' (length=3)
'naam' => string 'Veertoestel KR 503 02' (length=21)
I know I can do this in the query but in this specific scenario unfortunately that's no option. I have no idea how to accomplish this task in php itself.
I was hoping someone could help me out.