FIX - check for data in SQL result
This commit is contained in:
parent
b144d21cb3
commit
4670e553b2
@ -98,7 +98,7 @@ class Worker extends Base {
|
||||
**/
|
||||
public function getWorker($id, $interval=600) {
|
||||
$this->debug->append("STA " . __METHOD__, 4);
|
||||
$stmt = $this->mysqli->prepare("
|
||||
$stmt = $this->mysqli->prepare($q ="
|
||||
SELECT id, username, password, monitor,
|
||||
(
|
||||
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 @@ class Worker extends Base {
|
||||
) AS shares
|
||||
FROM $this->table AS w
|
||||
WHERE id = ?");
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param('iiiii', $interval, $interval, $interval, $interval, $id) && $stmt->execute() && ($result = $stmt->get_result())) {
|
||||
$row = $result->fetch_assoc();
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param('iiiii', $interval, $interval, $interval, $interval, $id) && $stmt->execute() && ($result = $stmt->get_result()) && ($row = $result->fetch_assoc())) {
|
||||
$row['hashrate'] = round($this->coin->calcHashrate($row['shares'], $interval), 2);
|
||||
if ($row['count_all'] > 0) {
|
||||
$row['difficulty'] = round($row['shares'] / $row['count_all'], 2);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user