user2201189
user2201189

Reputation: 79

JSON to a HTML Table

Well i still haven't solved this. Been at it for a couple of days now. What i have done already is: I have written a php script which echos my JSON data structure. I am now trying to write a Html script which will obtain the results in JSON format but echo this out in a html table. I coded my html page, however for some reason the table isn't showing up.

Ok what my json_encode($res->fetchAll()) echo looks like is this;

[{"name":"Victoria 

Upvotes: 2

Views: 215

Answers (2)

Musa
Musa

Reputation: 97672

Your out is not valid json, the echo "{$res->numRows()}<br/>"; invalidates it and needs to be removed.

Upvotes: 0

NullPointerException
NullPointerException

Reputation: 3804

Use data tables . It is very powerful and easy to use java script api. It provides a lot of features as well like sorting searching etc.

You only have to change the format of JSON and rest all will be taken care by datatables.

An example

Upvotes: 1

Related Questions