$query=$mysqli->prepare("SELECT name FROM services WHERE id=?");
$query->bind_param("i",$_GET['id']);
$query->execute();
$result=$query->get_result()->fetch_assoc();
if(!count($result))
{
die(json_encode(["error"=>_("Service does not exist!")]));
}
$sql=$mysqli->prepare("SELECT type FROM services_status INNER JOIN status ON services_status.status_id = status.id WHERE service_id = ? AND `time` <= ? AND (`end_time` >= ? OR `end_time`=0) ORDER BY `time` DESC LIMIT 1");