Skip to content

Commit 4670e55

Browse files
committed
FIX - check for data in SQL result
1 parent b144d21 commit 4670e55

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

include/classes/worker.class.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function getAllIdleWorkers($interval=600) {
9898
**/
9999
public function getWorker($id, $interval=600) {
100100
$this->debug->append("STA " . __METHOD__, 4);
101-
$stmt = $this->mysqli->prepare("
101+
$stmt = $this->mysqli->prepare($q ="
102102
SELECT id, username, password, monitor,
103103
(
104104
SELECT COUNT(id) FROM " . $this->share->getTableName() . " WHERE our_result = 'Y' AND username = w.username AND time > DATE_SUB(now(), INTERVAL ? SECOND)
@@ -124,8 +124,7 @@ public function getWorker($id, $interval=600) {
124124
) AS shares
125125
FROM $this->table AS w
126126
WHERE id = ?");
127-
if ($this->checkStmt($stmt) && $stmt->bind_param('iiiii', $interval, $interval, $interval, $interval, $id) && $stmt->execute() && ($result = $stmt->get_result())) {
128-
$row = $result->fetch_assoc();
127+
if ($this->checkStmt($stmt) && $stmt->bind_param('iiiii', $interval, $interval, $interval, $interval, $id) && $stmt->execute() && ($result = $stmt->get_result()) && ($row = $result->fetch_assoc())) {
129128
$row['hashrate'] = round($this->coin->calcHashrate($row['shares'], $interval), 2);
130129
if ($row['count_all'] > 0) {
131130
$row['difficulty'] = round($row['shares'] / $row['count_all'], 2);

0 commit comments

Comments
 (0)