Good morning I have a question as to how to get all the data registered in the database with my code. because I'm trying and my while
is entering loop
infinite could anyone help me?
class code:
require_once 'banco.php';
class Album{
public $id;
public $nomeAlbum;
public $img;
public function listAll(){
$con = new Conexao();
$con->conectar();
$sql = mysqli_query($con->conectar(), "SELECT nome_album, img FROM album");
$con->desconectar();
return $sql;
}
}
index code
require_once "album.class.php";
$obj = new Album();
while($aux = mysqli_fetch_object($obj->listAll())){
echo $aux->img;
}