<?php
include_once"config.php";
$e = mysqli_query($con, "select add_special_category.* from add_special_category inner join special_category on special_category.name = add_special_category.id group by add_special_category.name");

?>

<div id="area " style="margin-top:45px">
<section>
<h2><em><?= $category_nat_title; ?></em></h2>
<div class="col-12" style="margin-bottom:40px;">

<table border="0" cellpadding="7" width="100%" cellspacing="0">
<thead>
<tr>
<td width="20%">Categories</td>
<?php 
$listnc = array();
$natic = mysqli_query($con,"select * from nati where status = 1 order by name");
while($nac = mysqli_fetch_array($natic)){$listnc[] = $nac['name'];}
$part = 80/count($listnc);
foreach($listnc as $lc){
?>
<td width="<?= $part;?>%"><?= $lc; ?></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%"><?php echo  $name = $s['name'];  ?></td>

<?php foreach($listnc as $ln){
	
$sp = mysqli_query($con, "select * from category_nationailty where name = '$pid' and pid = '$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>
