I'm doing a query to an influxdb database and at the end I have a result like this:
stdClass Object (
[results] => Array (
[0] => stdClass Object (
[statement_id] => 0
[series] => Array (
[0] => stdClass Object (
[name] => custom
[tags] => stdClass Object (
[hostname] => linux001 )
[columns] => Array (
[0] => time [1] =>
cpu [2] => mem [3]
=> load [4] => load )
[values] => Array (
[0] => Array ( [0] => 1970-01-01T00:00:00Z [1] => 1 [2] => 78 [3] => 0 [4] => 0 ) ) )) )
) )
But now I want for example to have a table like this:
<style type="text/css">
.tg {border-collapse:collapse;border-spacing:0;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}
.tg .tg-s268{text-align:left}
.tg .tg-0lax{text-align:left;vertical-align:top}
</style>
<table class="tg">
<tr>
<th class="tg-s268">hostname</th>
<th class="tg-s268">time</th>
<th class="tg-s268">cpu</th>
<th class="tg-0lax">mem</th>
<th class="tg-0lax">load</th>
</tr>
<tr>
<td class="tg-s268">linux001</td>
<td class="tg-s268">1970-01-01T00:00:00Z</td>
<td class="tg-s268">1</td>
<td class="tg-0lax">78</td>
<td class="tg-0lax">0</td>
</tr>
</table>
The problem is that I can not build the table, I do not know how to iterate over those elements, I'm new to json. Thank you very much.