{ "status": "1", "message": "OK", "result": [ { "blockNumber": "9463854", "timeStamp": "1581452755", "hash": "0x70cc659946bc622ce17d66a67290423d50b32270cb7c6250e965956efa8b962d", "nonce": "24", "blockHash": "0xc60e1d62552e9e5839667e3c3929b8092dc1968601cb33c5470ee312167557a3", "transactionIndex": "9", "from": "0x3fc3f37bd729603cfbd7711156c8a9ee50e3578c", "to": "0x370740acd9369f32c837cbb7fc40bbb721c5d318", "value": "50000000000000000", "gas": "21000", "gasPrice": "13000000000", "isError": "0", "txreceipt_status": "1", "input": "0x", "contractAddress": "", "cumulativeGasUsed": "410433", "gasUsed": "21000", "confirmations": "116533" }, { "blockNumber": "9463862", "timeStamp": "1581452893", "hash": "0x4059bae4387bbb422ce9a3c10b94e2945c052846139143e39ea2d4870ea2c696", "nonce": "0", "blockHash": "0x1e1258a9b35abe2010ff12f8f191f380a38729aa28d9ea77151685c5f4ff74e2", "transactionIndex": "21", "from": "0x370740acd9369f32c837cbb7fc40bbb721c5d318", "to": "0xbcf935d206ca32929e1b887a07ed240f0d8ccd22", "value": "30000000000000000", "gas": "279362", "gasPrice": "10000000000", "isError": "0", "txreceipt_status": "1", "input": "0x8853b53e0000000000000000000000000000000000000000000000000000000000016eaa", "contractAddress": "", "cumulativeGasUsed": "1141363", "gasUsed": "214894", "confirmations": "116525" }, { "blockNumber": "9499271", "timeStamp": "1581924331", "hash": "0x9670177bbef152974c5790f007896bc222516a64a9d2d3db8e012375f505d8d1", "nonce": "1", "blockHash": "0xb0c821fb0e94689912578ebcd2220f5ad919b17d588939af21d2bcf24ab1335b", "transactionIndex": "36", "from": "0x370740acd9369f32c837cbb7fc40bbb721c5d318", "to": "0xbcf935d206ca32929e1b887a07ed240f0d8ccd22", "value": "50000000000000000", "gas": "83361", "gasPrice": "4000000000", "isError": "0", "txreceipt_status": "1", "input": "0xf6838a720000000000000000000000000000000000000000000000000000000000000002", "contractAddress": "", "cumulativeGasUsed": "1414997", "gasUsed": "64124", "confirmations": "81116" }, { "blockNumber": "9571802", "timeStamp": "1582888995", "hash": "0xeb0c36285253d4e4e53f1c68ff0905dcd3e6300af7cd39a24cff44a41a5f8d6a", "nonce": "0", "blockHash": "0x1750e09bdd65d057f9b818f3554632850c359cee1a5cbb0ee3567fd728cf71be", "transactionIndex": "236", "from": "0x0389775569c6777ccbd157e62b8ca4a91aa0d885", "to": "0x370740acd9369f32c837cbb7fc40bbb721c5d318", "value": "67537140000000000", "gas": "21000", "gasPrice": "8000000000", "isError": "0", "txreceipt_status": "1", "input": "0x", "contractAddress": "", "cumulativeGasUsed": "8741378", "gasUsed": "21000", "confirmations": "8585" } ] }
-
Have you tried anything?Rob– Rob2020-03-02 06:31:28 +00:00Commented Mar 2, 2020 at 6:31
-
yes, but the function returns the entire table row in a single lineHayWhy– HayWhy2020-03-02 06:34:15 +00:00Commented Mar 2, 2020 at 6:34
-
Show us what have you tried so far.Rob– Rob2020-03-02 06:34:58 +00:00Commented Mar 2, 2020 at 6:34
-
function build_table($data){ // start table $html = '<table>'; // header row $html .= '<tr>'; foreach($data["result"][0] as $key=>$value){ $html .= '<th>' . htmlspecialchars($key) . '</th>'; } $html .= '</tr>'; // data rows foreach( $data as $key=>$value){ $html .= '<tr>'; foreach($value[0] as $key2=>$value2){ $html .= '<td>' . $value2 . '</td>'; } $html .= '</tr>'; } // finish table and return it $html .= '</table>'; return $html; } echo build_table($data);HayWhy– HayWhy2020-03-02 06:43:30 +00:00Commented Mar 2, 2020 at 6:43
-
the example from here did not work for me either stackoverflow.com/questions/28970612/…HayWhy– HayWhy2020-03-02 07:06:29 +00:00Commented Mar 2, 2020 at 7:06
Add a comment
|
1 Answer
<table>
<thead>
<tr>
<th>Time</th>
<th>Txn Hash</th>
<th>From</th>
<th>To</th>
<th>Value (ETH)</th>
<th>Value (USD)</th>
</tr>
</thead>
<?php
foreach ($data['result'] as $key => $value) { ?>
<tbody>
<tr>
<td> <?php echo $value['timeStamp']; ?> </td>
<td> <?php echo $value['hash']; ?> </td>
<td> <?php echo $value['from']; ?> </td>
<td> <?php echo $value['to']; ?> </td>
<td> <?php echo $value['value']; ?> </td>
</tr>
</tbody>
<?php } ?>
</table>