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 $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)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user