Skip to content
Advertisement

How to parse json array from mysql?

I have this data but I can’t parse it in the way I want. this is what I get:

JavaScript

And what I expect to see:

JavaScript

I have more results in my database but not more than 12 result so, i want to fetch data in the format i expect. I tried to do it using fetch_array but no success.

This is my PHP code:

JavaScript

I searched for an answer but nothing solved my issue 🙁

Advertisement

Answer

You need to push the row onto the array, not overwrite it each time.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement