Robert Dickey Robert Dickey - 1 year ago 87
JSON Question

Trouble creating table with Json_Decode

I am working with another company's AP and they return a set of data to me via XML. I am attempting to take that xml data, and turn it into an HTML table. The XML decodes perfectly, and I can display the

in a non-table format, but when I try to format it, I receive a server error..I am at my wits end here.

Here is my code (bottom half)

$array = json_decode(json_encode((array)simplexml_load_string($result)),1);


$tab='<table border="1" width="400">';
for ($j=1; $j< count($array_user) ; $j++) {



echo $tab;

Does anyone with experience in this area know why or see why I am receiving a generic error? Any help would be greatly appreciated.

Answer Source

You missed to close all string literals.

So for example the following line:


must look like this:

$tab.='<td>'.$array_user[$j]['id'].'</td>'; // <-- note the closing '
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download