public function updateScore($fScore, $iId, $sTable) { $sTable = Various::checkTable($sTable); $sWhere = Various::convertTableToId($sTable); $rStmt = Db::getInstance()->prepare('UPDATE' . Db::prefix($sTable) . 'SET score = :score WHERE ' . $sWhere . ' = :id'); $rStmt->bindValue(':score', $fScore); $rStmt->bindValue(':id', $iId); return $rStmt->execute(); }
/** * This method was created to avoid retrieving the column "views" with the general Model of the module, * since it uses the cache and therefore cannot retrieve the number of real-time views. * * @param integer $iId * @param string $sTable * @return integer Number of views. */ public static function getView($iId, $sTable) { $sWhere = Various::convertTableToId($sTable); $rStmt = Db::getInstance()->prepare('SELECT views FROM' . Db::prefix($sTable) . 'WHERE ' . $sWhere . ' = :id LIMIT 1'); $rStmt->bindValue(':id', $iId, \PDO::PARAM_INT); $rStmt->execute(); $oRow = $rStmt->fetch(\PDO::FETCH_OBJ); Db::free($rStmt); return (int) @$oRow->views; }