Permalink
Browse files

Update get_crypto_symbol_by_external_address.php

Refactor to use blockchain_transactions table.
  • Loading branch information...
whotooktwarden committed Mar 2, 2016
1 parent dad77d6 commit cc787fdc3611aba958c67e484188b42a32929a1e
Showing with 3 additions and 4 deletions.
  1. +3 −4 get_crypto_symbol_by_external_address.php
@@ -34,19 +34,18 @@
died($error_message);
}
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, direction, timestamp, finished FROM coin_index WHERE crypto_symbol = ". $cryptocode . " AND WHERE external_address = ". $external .";";
//assign SQL to a variable for query execution
$sql = "SELECT id, crypto_symbol, crypto_address, external_address, is_inbound, rc_timestamp, finished, bc_blockhash, bc_amount, bc_txid FROM blockchain_transactions WHERE crypto_symbol = ". $cryptocode . " AND WHERE external_address = ". $external .";";
//connect to the database, execute the $sql, store the returned array within $result
//script exits gracefully if connection cannot be established
$result = $conn->query($sql);
//if the returned array has data
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "id: " . $row["id"]. " - Crypto Symbol: " . $row["crypto_symbol"]. " - Cryptocurrency Address: " . $row["crypto_address"].
" - External Address: " . $row["external_address"].
" - Time-stamp: " . $row["timestamp"]. " - Direction: " . $row["direction"]. " - Finished: " . $row["finished"]. "<br />";
" - Time-stamp: " . $row["rc_timestamp"]. " - Is Inbound: " . $row["is_inbound"]. " - Finished: " . $row["finished"]. " - Blockhash: ". $row["bc_blockhash"]. " Amount: " . $row["bc_txid"]. " TxID: " . $row["bc_txid"]. "<br />";
}
} else {
//else there were no results, notify RC operator

0 comments on commit cc787fd

Please sign in to comment.