0
Good morning!! I’m trying to create a report of student grades using PHP, the fact is that I created a table to list the notes vertically within a loop, but for each student is generated a table, I’m not able to tabulate the result side by side . I also need every time I change the instructor repeat the header, that is every 8 lines...
Follows the code:
<?php include_once "con_odbc.php" ?>
<div class="hidden-print"><b style=color:#ff0000><h4>Selecione o curso</h4></b> <form method="get" >
<select name="data" id="data">
<?php
$tal=0;
$total =0;
$res=0;
$x=0;
$sqlquery=("SELECT apde.CadCrs.idCadCrs,
apde.CadCrs.Abrev as Data,
apde.CadCrs.Per,
apde.CadCrs.DtIni,
apde.CadCrs.DtFin,
apde.CadCrs.Flag
FROM apde.CadCrs");
$res = odbc_exec($connect, $sqlquery);
while ($dados =odbc_fetch_array($res)) {
echo("<option value='".$dados['Data']."'>".$dados['Data']."</option>");
}
?>
</select>
</tr>
<tr>
</tr>
</table>
<td> <input type="submit" name="OK" value="Mostrar"><td><a class="btn btn-default ewExportLink ewPrint" onclick="window.print();" title="" >
<span class="icon-print ewIcon"></a></div><br>
<bgcolor='#FFFFCC'><div class="hidden-print"><a href="#abaixo" name="topo"><input type='button' value="IR PARA O FIM"></a></div>
<div class="modal-content" width="600px">
<div class="modal-content" >
<div class="modal-header">
<span id=layer1 class=a1></span>
<span id=layer1 class=a1></span>
</td>
</tr>
<tr>
<br>
</form>
<br>
<table width="950" border="0" align="center" cellpadding="2" cellspacing="2">
<thead>
<TR bgcolor="<?php echo ($ac_sw1++%2==0)?"#E4E4E4":"#FFFFFF"; ?>" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor=''">
<TD COLSPAN="40"><CENTER><b><font color="red" face="Times New Roman">Relatório de Notas </font> </b></CENTER></TD>
</TR>
<tr bgcolor="<?php echo ($ac_sw1++%2==0)?"#E4E4E4":"#FFFFFF"; ?>" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor=''">
<td>Id</td>
<td>Curso</td>
<td>Instrutor</td>
<td>Critério</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
<td>9</td>
<td>10</td>
<td>11</td>
<td>12</td>
<td>13</td>
<td>14</td>
<td>15</td>
<td>16</td>
<td>17</td>
<td>18</td>
<td>19</td>
<td>20</td>
<td>21</td>
<td>22</td>
<td>23</td>
<td>24</td>
<td>25</td>
<td>26</td>
<td>27</td>
<td>28</td>
<td>29</td>
<td>30</td>
<td>31</td>
<td>32</td>
<td>33</td>
<td>34</td>
<td>35</td>
<td>36</td>
</tr></thead><tbody>
<?php
if(isset($_GET["OK"])){
$Data= $_GET["data"];
$contador = 0;
$sqlquery=("SELECT Abrev, NomGue, TipAval, Aluno_1, Aluno_2, Aluno_3, Aluno_4, Aluno_5, Aluno_6, Aluno_7, Aluno_8, Aluno_9, Aluno_10, Aluno_11, Aluno_12, Aluno_13, Aluno_14, Aluno_15, Aluno_16, Aluno_17, Aluno_18, Aluno_19, Aluno_20, Aluno_21, Aluno_22, Aluno_23, Aluno_24, Aluno_25, Aluno_26, Aluno_27, Aluno_28, Aluno_29, Aluno_30, Aluno_31, Aluno_32, Aluno_33, Aluno_34, Aluno_35, Aluno_36 FROM APDE.apde.V_AvInstru where Abrev = '$Data' order by NomGue asc");
$res = odbc_exec($connect, $sqlquery);
while ($dados =odbc_fetch_array($res) )
{
if($contador == 8)
{
?></tr>
<br>
<br>
<br>
<br>
<table border="1" align="center" cellpadding="2" cellspacing="2">
<tr bgcolor="<?php echo ($ac_sw1++%2==0)?"#E4E4E4":"#FFFFFF"; ?>" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor=''">
<td width="35" height="22" align="center">ID</td>
<td width="500" align="center">Curso</td>
<td width="500" align="center">
Instrutor</td>
<td width="400">Critério
</td>
<td width="50">1</td>
<td width="50">2</td>
<td width="50">3</td>
<td width="50">4</td>
<td width="50">5</td>
<td width="50">6</td>
<td width="50">7</td>
<td width="50">8</td>
<td width="50">9</td>
<td width="50">10</td>
<td width="50">11</td>
<td width="50">12</td>
<td width="50">13</td>
<td width="50">14</td>
<td width="50">15</td>
<td width="50">16</td>
<td width="50">17</td>
<td width="50">18</td>
<td width="50">19</td>
<td width="50">20</td>
<td width="50">21</td>
<td width="50">22</td>
<td width="50">23</td>
<td width="50">24</td>
<td width="50">25</td>
<td width="50">26</td>
<td width="50">27</td>
<td width="50">28</td>
<td width="50">29</td>
<td width="50">30</td>
<td width="50">31</td>
<td width="50">32</td>
<td width="50">33</td>
<td width="50">34</td>
<td width="50">35</td>
<td width="50">36</td>
</tr></thead><tr>
<?php
$contador = 0;
}
?>
<tr bgcolor="<?php echo ($ac_sw1++%2==0)?"#E4E4E4":"#FFFFFF"; ?>" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor=''">
<td width="35" height="22" align="center"><?php echo $contador; ?></td>
<td width="500" align="center"><?php echo $dados['Abrev']; ?></td>
<td width="133" align="center">
<?php echo $dados['NomGue']; ?></td>
<td width="400"><?php echo $dados['TipAval']; ?>
</td>
<td width="50"><?php echo $dados['Aluno_1']; ?></td>
<td width="50"><?php echo $dados['Aluno_2']; ?></td>
<td width="50"><?php echo $dados['Aluno_3']; ?></td>
<td width="50"><?php echo $dados['Aluno_4']; ?></td>
<td width="50"><?php echo $dados['Aluno_5']; ?></td>
<td width="50"><?php echo $dados['Aluno_6']; ?></td>
<td width="50"><?php echo $dados['Aluno_7']; ?></td>
<td width="50"><?php echo $dados['Aluno_8']; ?></td>
<td width="50"><?php echo $dados['Aluno_9']; ?></td>
<td width="50"><?php echo $dados['Aluno_10']; ?></td>
<td width="50"><?php echo $dados['Aluno_11']; ?></td>
<td width="50"><?php echo $dados['Aluno_12']; ?></td>
<td width="50"><?php echo $dados['Aluno_13']; ?></td>
<td width="50"><?php echo $dados['Aluno_14']; ?></td>
<td width="50"><?php echo $dados['Aluno_15']; ?></td>
<td width="50"><?php echo $dados['Aluno_16']; ?></td>
<td width="50"><?php echo $dados['Aluno_17']; ?></td>
<td width="50"><?php echo $dados['Aluno_18']; ?></td>
<td width="50"><?php echo $dados['Aluno_19']; ?></td>
<td width="50"><?php echo $dados['Aluno_20']; ?></td>
<td width="50"><?php echo $dados['Aluno_21']; ?></td>
<td width="50"><?php echo $dados['Aluno_22']; ?></td>
<td width="50"><?php echo $dados['Aluno_23']; ?></td>
<td width="50"><?php echo $dados['Aluno_24']; ?></td>
<td width="50"><?php echo $dados['Aluno_25']; ?></td>
<td width="50"><?php echo $dados['Aluno_26']; ?></td>
<td width="50"><?php echo $dados['Aluno_27']; ?></td>
<td width="50"><?php echo $dados['Aluno_28']; ?></td>
<td width="50"><?php echo $dados['Aluno_29']; ?></td>
<td width="50"><?php echo $dados['Aluno_30']; ?></td>
<td width="50"><?php echo $dados['Aluno_31']; ?></td>
<td width="50"><?php echo $dados['Aluno_32']; ?></td>
<td width="50"><?php echo $dados['Aluno_33']; ?></td>
<td width="50"><?php echo $dados['Aluno_34']; ?></td>
<td width="50"><?php echo $dados['Aluno_35']; ?></td>
<td width="50"><?php echo $dados['Aluno_36']; ?></td>
</tr>
<?php
$contador++;
}}
?>
</table>
Hello, thanks for the effort and the tips, I took the test here and the error continues repeating the tables for each student...
– Vanessa Olimpio