<?php
// include('dbconnection/dbconnection.php');

// class main{
	
	function login($user,$password,$connect){
		
		
	}
	
// } 
 function staff_loggedin($key,$con){
	$query="SELECT * FROM staff where emp_no='$key'";
	$statement=$con->prepare($query);
	$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
}

 function single_user($con,$k){
	$query="SELECT * FROM staff where emp_no='$k'";
	$statement=$con->prepare($query);
	$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
}



function staff_team($con){
	$query='SELECT * FROM `staff` LIMIT 8';
	$statement=$con->prepare($query);
	$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
	
}

function school_details($con){
	$query='SELECT * FROM `school_details` LIMIT 1';
	$statement=$con->prepare($query);
	$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
	
}

function few_students($con){
	$query='SELECT * FROM `students` LIMIT 8';
	$statement=$con->prepare($query);
	$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
	
}

function students($con){
	$query='SELECT * FROM `students`  ';
	$statement=$con->prepare($query);
	$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
	
}

function subscribers($con){
	$query='SELECT * FROM `subscribers` ';
	$statement=$con->prepare($query);
	$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
	
}

function services($con){
	$query='SELECT * FROM `services` ORDER BY service ASC';
	$statement=$con->prepare($query);
	$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
	
}

function latest_notes($con){
	$query='SELECT * FROM `notes` ORDER BY date DESC LIMIT 10';
	$statement=$con->prepare($query);
	$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
	
}



function few_latest_notes($con){
	$query='SELECT * FROM `notes` ORDER BY date DESC LIMIT 5';
	$statement=$con->prepare($query);
	$statement->execute(array());
	$results=$statement->fetchAll();
	return  $results;
	
}

function user_few_latest_notes($con,$k){
	$query='SELECT * FROM `notes` WHERE user= :k ORDER BY date DESC LIMIT 5';
	$statement=$con->prepare($query);
	$statement->execute(array("k" =>$k));
	$results=$statement->fetchAll();
	return  $results;
	
}

function last_notes($con){
	$query='SELECT * FROM `notes` ORDER BY date DESC LIMIT 1';
	$statement=$con->prepare($query);
	$statement->execute(array());
	$results=$statement->fetchAll();
	return  $results;
	
}

function single_notes($con,$k){
$query = "
		SELECT * FROM notes 
			WHERE id = :k 
		";
			$statement = $con->prepare($query);
		$statement->execute(
			array(
					'k'	=>	$k
				)
		);
	$results=$statement->fetchAll();
	return  $results;
	
}

function srelated_notes($con,$k,$ex){
$query = "
		SELECT * FROM notes 
			WHERE service = :k AND id!= :ex
		";
			$statement = $con->prepare($query);
		$statement->execute(
			array(
					'k'	=>	$k,
					'ex'	=>	$ex
				)
		);
	$results=$statement->fetchAll();
	return  $results;
	
}

function service_notes($con,$k){
$query = "
		SELECT * FROM notes 
			WHERE service = :k 
		";
			$statement = $con->prepare($query);
		$statement->execute(
			array(
					'k'	=>	$k
				)
		);
	$results=$statement->fetchAll();
	return  $results;
	
}

function single_service($con,$k){
$query = "
		SELECT * FROM services 
			WHERE id = :serv 
		";
			$statement = $con->prepare($query);
		$statement->execute(
			array(
					'serv'	=>	$k
				)
		);
	$results=$statement->fetchAll();
	return  $results;
	
}

function ssingle_service($con,$k){
$query = "
		SELECT * FROM services 
			WHERE service = :serv 
		";
			$statement = $con->prepare($query);
		$statement->execute(
			array(
					'serv'	=>	$k
				)
		);
	$results=$statement->fetchAll();
	return  $results;
	
}

function other_services($con,$ex){
$query = "
		SELECT * FROM services 
			WHERE id!= :ex
		";
			$statement = $con->prepare($query);
		$statement->execute(
			array(
					'ex'	=>	$ex
				)
		);
	$results=$statement->fetchAll();
	return  $results;
	
}

function latest_pagecomments($con){
$query = "
		SELECT * FROM page_comments ORDER BY id ASC LIMIT 8
		";
			$statement = $con->prepare($query);
		$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
	
}

function all_few_gallery($con){
$query = "
		SELECT * FROM events_gallery ORDER BY id DESC LIMIT 15
		";
			$statement = $con->prepare($query);
		$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
	
}

function last_gallery($con){
	$query = "
		SELECT * FROM events_gallery ORDER BY id DESC LIMIT 1
		";
			$statement = $con->prepare($query);
		$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
	
}

function all_events_gallery($con){
$query = "
		SELECT * FROM eventstbl WHERE status='0' ORDER BY id DESC LIMIT 15
		";
			$statement = $con->prepare($query);
		$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
	
}
function two_events_gallery($con){
$query = "
		SELECT * FROM eventstbl WHERE status='0' ORDER BY id DESC LIMIT 2
		";
			$statement = $con->prepare($query);
		$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
	
}

function three_events_gallery($con){
$query = "
		SELECT * FROM eventstbl WHERE status='0' ORDER BY id DESC LIMIT 3
		";
			$statement = $con->prepare($query);
		$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
	
}

function four_events_gallery($con){
$query = "
		SELECT * FROM eventstbl WHERE status='0' ORDER BY id DESC LIMIT 4
		";
			$statement = $con->prepare($query);
		$statement->execute();
	$results=$statement->fetchAll();
	return  $results;
	
}

?>