Funkcja PHP mysqli_fetch_all ()

$returnResult = []; //initialise empty array
while($row = $result->fetch_assoc())
{
    $returnResult[] = $row;
}
Codemaster