allow searching blocks in reverse order for sharecounter
This commit is contained in:
parent
b9904a5eee
commit
6486a72b1b
@ -8,7 +8,7 @@ class Block {
|
|||||||
private $sError = '';
|
private $sError = '';
|
||||||
private $table = 'blocks';
|
private $table = 'blocks';
|
||||||
// This defines each block
|
// This defines each block
|
||||||
public $height, $blockhash, $confirmations, $difficulty, $time;
|
public $height, $blockhash, $confirmations, $time, $accounted;
|
||||||
|
|
||||||
public function __construct($debug, $mysqli, $salt) {
|
public function __construct($debug, $mysqli, $salt) {
|
||||||
$this->debug = $debug;
|
$this->debug = $debug;
|
||||||
@ -35,6 +35,17 @@ class Block {
|
|||||||
return false;
|
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) {
|
public function addBlock($block) {
|
||||||
$stmt = $this->mysqli->prepare("INSERT INTO $this->table (height, blockhash, confirmations, amount, time) VALUES (?, ?, ?, ?, ?)");
|
$stmt = $this->mysqli->prepare("INSERT INTO $this->table (height, blockhash, confirmations, amount, time) VALUES (?, ?, ?, ?, ?)");
|
||||||
if ($this->checkStmt($stmt)) {
|
if ($this->checkStmt($stmt)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user