i have a mysql db with only one table that gives me following output.
[{country:"austria","state":"upper austria","city":"vienna","plz":"1000","name":"test 1"},{country:"austria","state":"upper austria","city":"vienna","plz":"1000","name":"test 2"},{country:"austria","state":"upper austria","city":"vienna","plz":"1010","name":"test 3"},{country:"austria","state":"lower austria","city":"krems","plz":"2222","name":"test 4"}]
and i need something like that
{
"data": [
{
"country": "austria",
"state": "upper austria",
"city": "vienna",
"plz": "1000",
"persons": [
{
"name": "test 1",
"name": "test 2"
}
]
},
{
"country": "austria",
"state": "upper austria",
"city": "vienna",
"plz": "1010",
"persons": [
{
"name": "test 3"
}
]
},
{
"country": "austria",
"state": "lower austria",
"city": "krems",
"plz": "2222",
"persons": [
{
"name": "test 4"
}
]
}
]}
at least it should be displayed like that
austria
--> upper austria
----> vienna
------>1000
--------> test 1
--------> test 2
------>1010
--------> test 3
--> lower austria
----> krems
------>2222
--------> test 4
i tried a lot of solutions, but i get not the right results…
does anyone have an example for me, how i can realize that?
thanks a lot
cheers martin