<?php

function emirate_area($pid,$value,$con){
	
	$query = mysqli_query($con,"select * from area where pid = '$pid'");
	
	while($q = mysqli_fetch_array($query)){
		$per = $q['percent']; 
		$id  = $q['id'];
		$values = ($value*$per) / 100;
		mysqli_query($con, "update area set value = '$values'  where id =  $id ");
		
	}
	
	
}


function emirate_nationailty($pid,$value,$con){
	$query = mysqli_query($con,"select * from nationailty where pid = '$pid'");
	
	while($q = mysqli_fetch_array($query)){
		$per = $q['percent']; 
		$id  = $q['id'];
		$values = ($value*$per) / 100;
		mysqli_query($con, "update nationailty set value = '$values'  where id =  $id ");
		
	}
}

function emirate_category($pid,$value,$con){
	
	$query = mysqli_query($con,"select * from special_category where pid = '$pid'");
	
	while($q = mysqli_fetch_array($query)){
		$per = $q['percent']; 
		$id  = $q['id'];
		$values = ($value*$per) / 100;
		mysqli_query($con, "update special_category set value = '$values'  where id =  $id ");
		
		
	}
}
