I have a function in PHP using MySQL, it follows:
public function listAll(){
$sql = mysqli_query($this->conectar, "SELECT * FROM items");
$this->desconectar;
return $sql->fetch_all();
}
My page for instance:
$p = new Items();
$result = $p->listAll();
$r = new ArrayIterator($result);
print_r($r);
When I give a print_r
it returns me this
ArrayIterator Object ( [storage:ArrayIterator:private] => Array ( [0] => Array ( [0] => 3 [1] => prod test 3)))
When I try to call the name it returns me this:
echo $r->current()->nome
Trying to get property of non-object in
result of print_r($result)
Array ( [0] => Array ( [0] => 3 [1] => prod test 3)