<?php
include_once"config.php";
$e = mysqli_query($con, "select * from emirate where status = 1 order by name");

?>

<div id="area " style="margin-top:45px">
    
<h2><em><?= $natianilty_title; ?></em></h2>
<section>
<div class="col-12" style="margin-bottom:40px;">
<?php 
$listn = array();
$nati = mysqli_query($con,"select * from nati where status = 1 order by name");
while($na = mysqli_fetch_array($nati)){$listn[] = $na['name'];}
$part = 80/count($listn);
?>
<table border="0" cellpadding="7" width="100%" cellspacing="0">
<thead>
<tr>

<td width="20%">Categories</td>
<?php foreach($listn as $l){ ?>
<td width="<?=$part;?>%"><?= $l; ?></td>
<?php } ?>
</tr>
</thead>
<tbody>
<?php 

//$listn = array('Mix Arabs','Locals','Westerns','Asians','Other');
while($s = mysqli_fetch_array($e)){
	$pid = $s['id'];
	
	?>
<tr>
<td width="25%"><?= $name = $s['name'];  ?></td>

<?php foreach($listn as $ln){
$sp = mysqli_query($con, "select * from nationailty where pid = '$pid' and name = '$ln' and  status = 1  ");
if($sp->num_rows > 0){
while($pl = mysqli_fetch_array($sp)){
	?>
	<td><?=  $pl['value']; ?></td>
<?php }
	}else{
		?>
		<td> - </td>
		<?php 
	}
	} ?>



</tr>
<?php } ?>
</tbody>
</table>
</div>
</section>
</div>
