allow searching blocks in reverse order for sharecounter

This commit is contained in:
Sebastian Grewe 2013-05-10 22:36:27 +02:00
parent b9904a5eee
commit 6486a72b1b

View File

@ -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)) {