fetch_all不返回任何内容

Still a PHP Novice. I got PHP Version 5.6.2 using it with MAMP. I am trying to get all table entries. Code is:

$query = "SELECT * FROM atable";
$result = $db_connection->query($query);
if(!$result){
    $msg = $db_connection->error;
    die("The query failed! <br/>" . $msg);
} 
else {
    echo "Successfull query.";
}

Everything ok until here. The fetch_assoc() works too:

$output = $result->fetch_assoc();
print_r($output);

But fetch_all() doesn't work:

$output = $result->fetch_all();
print_r($output);

I tried getting an error message but received none.

I read that older Versions of PHP do not allow fetch_all and so I tried with a while loop, which again worked just fine. What am I doing wrong? :(

Thx for your help!

I think you may be missing execute();

you should use fetch_assoc() with a loop instead of fetch_all()

Try pg_fetch_all()

$output = $result->pg_fetch_all();
print_r($output);

pg_fetch_all() returns an array that contains all rows (records) in the result resource.