is that I want to save the data one while
by one array
, as I have it written, it only saves one data in the array when I print it, but when I put it var_dump
inside the cycle while
it does save everything.
<table id="table">
<thead>
<tr>
<th>#</th>
<th>Cod Materia</th>
<th>Notas</th>
<th>Periodo</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
while (oci_fetch($stid)) {
if (oci_result($stid, 'REAC_NOTAFINAL') > 3 ){
$notas = [oci_result($stid, 'MATE_CODIGOMATERIA')];
}
?>
<tr>
<td><?php echo $i++; ?></td>
<td><?php echo oci_result($stid, 'MATE_CODIGOMATERIA'); ?></td>
<td><?php echo oci_result($stid, 'REAC_NOTAFINAL'); ?></td>
<td><?php echo oci_result($stid, 'PEUN_ID'); ?></td>
</tr>
<?php
}
var_dump($notas);
oci_free_statement($stid);
oci_close($conn);
?>
</tbody>
</table>
It is precisely in:
while (oci_fetch($stid)) {
if (oci_result($stid, 'REAC_NOTAFINAL') > 3 ){
$notas = [oci_result($stid, 'MATE_CODIGOMATERIA')];
}
I think I am not saving it correctly and this data comes from aBD Oracle
The correct syntax for adding values to an array is as follows:
Applied to your code it would be: