diff --git a/public/include/classes/block.class.php b/public/include/classes/block.class.php index 6273af98..e24f82d4 100644 --- a/public/include/classes/block.class.php +++ b/public/include/classes/block.class.php @@ -8,7 +8,7 @@ class Block { private $sError = ''; private $table = 'blocks'; // This defines each block - public $height, $blockhash, $confirmations, $difficulty, $time; + public $height, $blockhash, $confirmations, $time, $accounted; public function __construct($debug, $mysqli, $salt) { $this->debug = $debug; @@ -35,6 +35,17 @@ class Block { return false; } + public function getAll($order='DESC') { + $stmt = $this->mysqli->prepare("SELECT * FROM $this->table ORDER BY height $order"); + if ($this->checkStmt($stmt)) { + $stmt->execute(); + $result = $stmt->get_result(); + $stmt->close(); + return $result->fetch_all(MYSQLI_ASSOC); + } + return false; + } + public function addBlock($block) { $stmt = $this->mysqli->prepare("INSERT INTO $this->table (height, blockhash, confirmations, amount, time) VALUES (?, ?, ?, ?, ?)"); if ($this->checkStmt($stmt)) {