Hi, don't know what's wrong, when i try to dispay an array, nothing is displayed.
// class.php
class Connection{
var $arr=array();
function getData($username){
$q="select comment_id from comments where user='$username'";
$result=$this->conn->query($upit);
$n=$result->num_rows;
for($i=0; $i<n; $i++){
$this->arr[$I]=$result->fetch_array[MYSQLI_ASSOC]; // I've also tried $this->arr[] (with no index) but the same thing
}
return $this->arr;
}
}
and here i call function
// data.php
$data=$Connection->getData($user); // count($data) is > that 0
foreach($data as $d){
echo $d.'<br />'; // nothing is displayed
}
Could someone resolve this or post some example of 1D array that is received from function. Thanks