<?php
session_start();
require('includes/config.php');
$created_at 	= strtotime(date('Y-m-d'));
$userId			= $_SESSION['userid'];
$user_id 		= $_REQUEST['id_Sp'];
$req_id 		= $_REQUEST['id_req'];
$description 	= $_REQUEST['description'];

if($_GET['type'] == "jobReject"){
	$reject_update_query = "update job_requests SET reject_reason = '".$description."', rejected_at = '".$created_at."', rejected_by = '".$user_id."' where request_id = '".$req_id."'";	
	$exe = mysqli_query( $con, $reject_update_query );		
		if( $exe ){
			$return = 1;
			//echo 'updated successfully';
				$update_query = "update service_provider_job_temp SET is_rejected = '".$user_id."', rejected_at = '".$created_at."' where user_id = '".$user_id."'";	
					$exe = mysqli_query( $con, $update_query );		
					if( $exe ){
						$return = 1;
						echo 'updated successfully';
					}else{
						$return = 0;
						echo ' update failed';
					}	
		}else{
			$return = 0;
			echo ' update failed';
		}
}

?>   