<?php

include("conexao.inc.php");



$sql = "select * from inscricoes";

$res = mysqli_query($conexao,$sql ) or die( 'Erro na query: <BR>' . $sql . '<BR>' . mysqli_error() );

$total_inscritos = mysqli_num_rows($res);

?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<style type="text/css">

<!--

.txt_form {	font-size: 9px;

	font-weight: bold;

}

body,td,th {

	font-family: Verdana, Geneva, sans-serif;

	font-size: 12px;

}

-->

</style>

<title>Relatório</title></head>



<body>

<table width="100%" border="1">

  <tr> 

    <td>Dias</td>

    <td>Ins./ dia</td>

    <td>6º </td>

    <td>7º </td>

    <td>8º </td>

	<td>9º</td>
    
    <td>9º C/MIL</td>

    <td>1ª </td>

    <td>2ª </td>

    <td>3ª</td>
    
    <td>3ª C/MIL - </td>
    
    <td>Pré</td>

    <td>Pré-Mil 9º</td>
    
    <td>Pré-Mil 3ª</td>
    
  </tr>



<?php

// Controle de datas

$data_inicio = "2014/07/01";

$dias_inscricao = 116;

$i = 1;



while ($i <= $dias_inscricao){



$Dat_result = date('Y/m/d', strtotime(str_replace('/', '-', $data_inicio) . '1 day'));

$data_inicio = date('Y/m/d', strtotime(str_replace('/', '-', $data_inicio) . '1 day'));



$data = $data_inicio;

$sql = "select * from inscricoes where data_inscricao='$data' order by id";

$res = mysqli_query($conexao,$sql ) or die( 'Erro na query: <BR>' . $sql . '<BR>' . mysqli_error() );

?>

  <tr> 

    <td><?php echo date('d/m/Y', strtotime($data_inicio));?></td>

    <td><?php echo mysqli_num_rows($res);?></td>

    <td>

		<?php 

		$sql = "select * from inscricoes where serie_ano='6o ano' and data_inscricao='$data' order by id";

		$res = mysqli_query($conexao,$sql ) or die( 'Erro na query: <BR>' . $sql . '<BR>' . mysqli_error() );

		echo mysqli_num_rows($res);

		?>

	</td>

    <td>

		<?php 

		$sql = "select * from inscricoes where serie_ano='7o ano'  and data_inscricao='$data' order by id";

		$res = mysqli_query($conexao,$sql ) or die( 'Erro na query: <BR>' . $sql . '<BR>' . mysqli_error() );

		echo mysqli_num_rows($res);

		?>

	</td>

    <td>

		<?php 

		$sql = "select * from inscricoes where serie_ano='8o ano'  and data_inscricao='$data' order by id";

		$res = mysqli_query($conexao, $sql ) or die( 'Erro na query: <BR>' . $sql . '<BR>' . mysqli_error() );

		echo mysqli_num_rows($res);

		?>

	</td>

    <td>

		<?php 

		$sql = "select * from inscricoes where serie_ano='9o ano'  and data_inscricao='$data' order by id";

		$res = mysqli_query($conexao, $sql ) or die( 'Erro na query: <BR>' . $sql . '<BR>' . mysqli_error() );

		echo mysqli_num_rows($res);

		?>

	</td>
    <td>

		<?php 

		$sql = "select * from inscricoes where serie_ano='9o mil' and data_inscricao='$data' order by id";

		$res = mysqli_query($conexao,$sql ) or die( 'Erro na query: <BR>' . $sql . '<BR>' . mysqli_error() );

		echo mysqli_num_rows($res);

		?>

	</td>

    <td>

		<?php 

		$sql = "select * from inscricoes where serie_ano='1a serie'  and data_inscricao='$data' order by id";

		$res = mysqli_query($conexao,$sql ) or die( 'Erro na query: <BR>' . $sql . '<BR>' . mysqli_error() );

		echo mysqli_num_rows($res);

		?>

	</td>

    <td>

		<?php 

		$sql = "select * from inscricoes where serie_ano='2a serie'  and data_inscricao='$data' order by id";

		$res = mysqli_query($conexao,$sql ) or die( 'Erro na query: <BR>' . $sql . '<BR>' . mysqli_error() );

		echo mysqli_num_rows($res);

		?>

	</td>

    <td>

		<?php 

		$sql = "select * from inscricoes where serie_ano='3a serie'  and data_inscricao='$data' order by id";

		$res = mysqli_query($conexao, $sql ) or die( 'Erro na query: <BR>' . $sql . '<BR>' . mysqli_error() );

		echo mysqli_num_rows($res);

		?>

	</td>
    <td>

		<?php 

		$sql = "select * from inscricoes where serie_ano='3a mil' and data_inscricao='$data' order by id";

		$res = mysqli_query($conexao, $sql ) or die( 'Erro na query: <BR>' . $sql . '<BR>' . mysqli_error() );

		echo mysqli_num_rows($res);

		?>

	</td>

    <td>

		<?php 

		$sql = "select * from inscricoes where serie_ano='Pre-Vestibular'  and data_inscricao='$data' order by id";

		$res = mysqli_query($conexao, $sql ) or die( 'Erro na query: <BR>' . $sql . '<BR>' . mysqli_error() );

		echo mysqli_num_rows($res);

		?>

	</td>

    <td>

		<?php 

		$sql = "select * from inscricoes where serie_ano='Pre-mil 9o'  and data_inscricao='$data' order by id";

		$res = mysqli_query($conexao, $sql ) or die( 'Erro na query: <BR>' . $sql . '<BR>' . mysqli_error() );

		echo mysqli_num_rows($res);

		?>

	</td>
    <td>

		<?php 

		$sql = "select * from inscricoes where serie_ano='Pre-mil 3o'  and data_inscricao='$data' order by id";

		$res = mysqli_query($conexao, $sql ) or die( 'Erro na query: <BR>' . $sql . '<BR>' . mysqli_error() );

		echo mysqli_num_rows($res);

		?>

	</td>
  </tr>

<?php 

$i++;

}

?>

</table>

<p><strong>Total de Inscritos: </strong><?php echo $total_inscritos;?></p>

</body>

</html>

