What I want is to extract the names from the database and save them in an array and then display them according to the order as I saved them in the array I want to save it in the $ student []
array <?php
$nombre = array();
include_once '../conexion.php';
$mysqli = new mysqli($hostbd,$usuariobd,$clave,$basededatos);
if ($mysqli -> connect_errno) {
die("Fallo Conexion a MySQL");
}
else{
$sql_query="SELECT Status,Alumno FROM computadoras WHERE Fila='1'";
$resultado=$mysqli->query($sql_query);
while($row=$resultado->fetch_assoc())
{
$status[] = $row["Status"];
$alumno[]= $row["Alumno"];
}
}
?>
This is where I call it to print
<div class="fila">
<?php
for ($i=0; $i <10 ; $i++) {
if ($status[$i]!=0) {
?>
<div id="info">
<img id="foto" src="img/computer(1).png" alt="computer"><span>Disponible</span>
</div>
<?php
}
else{ ?>
<div id="info">
<img id="foto" src="img/computer.png" alt="computer"><span>Matricula: <?php echo $alumno[$i]; ?></span>
</div>
<?php
}
}
?>
</div>
The status if it works for me, because it's only 1 or 0 if it's 1 prints something else, but when it's in use I want to know the name of the person who is using it