<?php
require_once dirname(__FILE__) . "/./queries.php";

function getHits($id, $db)
{
  global $getHitsQuery;
  $stmt = $db->prepare($getHitsQuery);
  $stmt->bindValue(":SID", $id);
  $stmt->execute();
  $hits = $stmt->fetch(PDO::FETCH_COLUMN);
  return $hits !== false ? $hits : 0;
}

function addHit($id, $db)
{
  global $setHitsQuery;
  $stmt = $db->prepare($setHitsQuery);
  $stmt->bindValue(":SID", $id);
  $stmt->execute();
}
