<?php
session_start();
require('includes/config.php');
$rid 			= $_GET['rid'];
$id 			= $_GET['user_id'];
$created_at 	= strtotime(date('Y-m-d'));
$userId			= $_SESSION['userid'];	
$job_insert = "insert into jobs( request_id, assigned_to, created_at, created_by ) values( '".$rid."', '".$id."', '".$created_at."', '".$userId."' )";
	$exe = mysqli_query( $con, $job_insert );		
		if( $exe ){
			$return = 1;
				echo "job allocate successfully";
				$update_query = "update my_calendar SET user_status = 'In-available', active = 0 where user_id = '".$id."'";	
				$exe = mysqli_query( $con, $update_query );		
					if( $exe ){
						$return = 1;
						$message = $description_title.' updated successfully';
					}else{
						$return = 0;
						$message = $description_title.' update failed';
					}
				}else{
					$return = 0;
					//$message = 'Error occured';
					echo "Error occured";
				}
				$user_name  = "";
				$email		= "";
				$mobile		= "";
					$sql = "SELECT user_id,name,phone,email FROM user_details WHERE user_id =".$id ;
					$result = $con->query($sql);
						if ($result->num_rows > 0) {
						    while($row = $result->fetch_assoc()) {
						        $user_name  = $row['name'];
						        $email		= $row['email'];
						        $phone		= $row['phone'];
						    }
						}
				$job_insert_temp = "insert into service_provider_job_temp( user_id ,request_id ,user_name ,email ,phone ) values( '".$id."','".$rid."','".$user_name."','".$email."','".$phone."' )";	
				$exe_temp = mysqli_query( $con, $job_insert_temp );		
?>   