user2322631 user2322631 - 3 years ago 66
HTML Question

Display the parsed JSON into html tables

I have tried hard in styling the JSON values that are printed randomly in page, here that are 4 categories,what I am doing with php then depending on the type id, as it is common in all array, to determine whether they belong to 0,1,2,3 category, then printing all the elements in the json array and so on, here I would like to create table for each category and push all the corresponding id's to the table rows. What I have tried so far

Answer Source

You did not add columns "td" in you code, please put proper format to create a table.

Try to put in this format :

foreach($json_o[account_detail] as $type)
echo 'Type '.$type[type] ;
echo "<table>";
  "<tr><td>".echo 'Name'.$type[name]."</td>";
  "<td>".echo 'Email'.$type[email_id]."</td>";
 "<td>".  echo 'Username'.$type[user_name]."</td>";
 "<td>".  echo 'Password'.$type[password]."</td>";
 "<td>".  echo 'Organisation name'.$type[org_name]."</td>";
 "<td>".  echo 'Location name'.$type[loc_name]."</td>";
 "<td>".  echo 'Building name'.$type[building_name].'."</td></tr>';     
//remaining code in same format with columns <td>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download