<?php
session_start();



define('DB_SERVER','localhost');
define('DB_USER','fmslogistics_vka_logistics');
define('DB_PASS' ,'fmslogistics_vka_logistics');
define('DB_NAME', 'fmslogistics_vka_logistics');
$conn = mysqli_connect(DB_SERVER,DB_USER,DB_PASS,DB_NAME);
$con = mysqli_connect(DB_SERVER,DB_USER,DB_PASS,DB_NAME);
// Check connection
if (mysqli_connect_errno())
{
 echo "Failed to connect to MySQL: " . mysqli_connect_error();
}


mysqli_query($conn, "SET SESSION sql_mode = ''");



// Host Name
$dbhost = 'localhost';
$dbname = 'fmslogistics_vka_logistics';
$dbuser = 'fmslogistics_vka_logistics';
$dbpass = 'fmslogistics_vka_logistics';
try {
	$pdo = new PDO("mysql:host={$dbhost};dbname={$dbname}", $dbuser, $dbpass);
	$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	ini_set('memory_limit', '2048M');
	$statement = $pdo->prepare("SET SESSION sql_mode = ''");
	$statement->execute();
}
catch( PDOException $exception ) {
	echo "Connection error :" . $exception->getMessage();
}


/*select the login details for checking client and admin*/
if($_SESSION['user']['role']=='Modicare')
{
$clientId=$_SESSION['user']['id'];
$clientLocation=$_SESSION['user']['location'];
$clientType=$_SESSION['user']['role'];
}else
{
$session_id=$_SESSION['user']['id'];
$statement = $pdo->prepare("SELECT * FROM `tbl_user` WHERE id=1");
$statement->execute();
$response = $statement->fetchAll(PDO::FETCH_ASSOC);
 foreach($response as $res)
 {
$clientId=$res['id'];
$clientLocation=$res['location'];
$clientType=$res['role'];
 }
}
?>