joecooper Posted August 23, 2011 Share Posted August 23, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/245514-json-query-to-a-table/ Share on other sites More sharing options...
requinix Posted August 23, 2011 Share Posted August 23, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/245514-json-query-to-a-table/#findComment-1261015 Share on other sites More sharing options...
silkfire Posted August 23, 2011 Share Posted August 23, 2011 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> Quote Link to comment https://forums.phpfreaks.com/topic/245514-json-query-to-a-table/#findComment-1261018 Share on other sites More sharing options...
doddsey_65 Posted August 23, 2011 Share Posted August 23, 2011 The above answer is good but please dont follow the code to the letter. use of the short tags "<?" can cause alot of problems if your server doesnt have the short_tags option enabled. Get into the habbit of using <?php Quote Link to comment https://forums.phpfreaks.com/topic/245514-json-query-to-a-table/#findComment-1261021 Share on other sites More sharing options...
silkfire Posted August 23, 2011 Share Posted August 23, 2011 Ye it's common sense to use '<?php' thanks Doddey. Quote Link to comment https://forums.phpfreaks.com/topic/245514-json-query-to-a-table/#findComment-1261036 Share on other sites More sharing options...
joecooper Posted August 23, 2011 Author Share Posted August 23, 2011 ahh thanks people! thats what i needed!! i have enabled short tags also . Quote Link to comment https://forums.phpfreaks.com/topic/245514-json-query-to-a-table/#findComment-1261112 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.