require_once 'connection.php';
$link = mysqli_connect($host, $user, $password, $database)
or die("Ошибка " . mysqli_error($link));
$sql = "select money from bot WHERE id_vk = $id order by money desc limit 10 ";
$result = $link->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$m = $row["money"];
}
}
mysqli_close($link);
$arr = [];
...
while($row = $result->fetch_assoc()) {
$arr[] = $row["money"];
}