获取数组php

I am working on fetching data from a table in PHP with the following code. How can I copy all rows directly into an array? I tried fetch_array() instead of fetch() but it was also not successful.

$stmt = $this->db->prepare($sql); 
$stmt->execute();
$stmt->bind_result($aID, $sID);

while ($stmt -> fetch()) { 
    echo $aID . " ". $sID . "<br>";
}           

How can I copy all rows directly into array?

$array = $stmt->fetchAll(PDO::FETCH_ASSOC);

If using PDO

the Fetch_column is what you are looking for

$stmt = $this->db->prepare($sql); 
        $stmt->execute();
        $stmt->bind_result($aID, $sID);
    $Arrays = $stmt ->fetchAll(PDO::FETCH_COLUMN);