I have the following SQL statement. "SELECT * FROM table"
Than I do: echo json_encode(mysqli_fetch_all($query));
Which gives me a json like this:
[
[
"32",
"John",
"12346",
"email@gmail.com",
]
]
This is all fine, but it's missing the field names.
How could I get a JSON like this:
[
[
"id" : "32",
"name" : "John",
"phone" : "12346",
"email" : "email@gmail.com",
]
]
Thanks!