Jump to content

JSON query to a table?


joecooper

Recommended Posts

Hi,

 

I dont know if many of you have heard of bitcoins? its just a virtual currency with real value...

 

I have got the daemon running for it, and have connected it to PHP.

 

The code i am using to return all transactions is:

 

print_r($bitcoin->listtransactions("")); echo "\n";

 

 

 

This will return:

 

Array

(

    [0] => Array

        (

            [account] =>

            [address] => 1ALtJaqGiShyGMVNRNn77E67PuBKc9FLyo

            [category] => receive

            [amount] => 0.001

            [confirmations] => 13

            [txid] => 0f36872c60da25b29ff3a8efa91d931e26fe1a4354da280f3d69234c8b521c8c

            [time] => 1314115260

        )

 

    [1] => Array

        (

            [account] =>

            [category] => move

            [time] => 1314115550

            [amount] => -0.001

            [otheraccount] => 4

            [comment] =>

        )

 

)

 

 

How could i output this info into a table instead of the above?

 

Thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/245514-json-query-to-a-table/
Share on other sites

foreach ($bitcoin->listtransactions("") as $transaction) {
    // insert into database
    // use $transaction["category"] and $transaction["time"] and so on
}

If you aren't sure how to go from there, search for PHP+MySQL tutorials.

Do you mean an SQL table or an (X)HTML table?

 

If the latter:

 

<table>
<?
   $transactions = $bitcoin->listtransactions('');

   foreach ($transactions as $field) {
?>
      <tr>
         <td><?=$field['account']?></td>
         <td><?=$field['address']?></td>
        <td><?=$field['category']?></td>

         ... and so on ...
      </tr>
<?
   }
?>
</table>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.