I was trying to get the data from a table, but I only get one data to come out. I did it by looking at an example, but I don't know what the truth is wrong
public function listarUsuarios(){
$sql = "SELECT *FROM usuario ";
$result = $this->conn->query($sql);
if ($result->num_rows > 0) {
$row = $result->fetch_all(MYSQLI_ASSOC);
return $row;
}
$this->conn->close();
}
<?php
foreach ($row as $key){
echo $key['nia'].'<br';
echo $key['password'].'<br';
}
?>
you have to close the tags
<br>
, it would be as follows: