From 5909fcaf4a12fa784090773bbbb35a4f1800c125 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 14 Sep 2023 03:28:02 +0300 Subject: [PATCH] add new methods --- src/library/database.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/library/database.php b/src/library/database.php index d09eec1..c88388e 100644 --- a/src/library/database.php +++ b/src/library/database.php @@ -575,6 +575,17 @@ class Database { return $query->rowCount(); } + public function updateUserTimeUpdated(int $userId, int $timeUpdated) : int { + + $this->_debug->query->update->total++; + + $query = $this->_db->prepare('UPDATE `user` SET `timeUpdated` = ? WHERE `userId` = ?'); + + $query->execute([$timeUpdated, $userId]); + + return $query->rowCount(); + } + // Magnet public function addMagnet(int $userId, int $xl, @@ -648,6 +659,17 @@ class Database { return $query->fetch()->result; } + public function findMagnet(int $userId, int $timeAdded) { + + $this->_debug->query->select->total++; + + $query = $this->_db->prepare('SELECT * FROM `magnet` WHERE `userId` = ? AND `timeAdded` = ?'); + + $query->execute([$userId, $timeAdded]); + + return $query->fetch(); + } + public function findMagnetsByUserId(int $userId) { $this->_debug->query->select->total++;