I would do it the following way:
$comments = array();
// Use your preferred mysql driver here
$result = $mysqli->query($query);
while ($row = $result->fetch_assoc()){
$comments[$row["id"]] = $row["comment"];
}
$success = ksort($comments);
ksort
will sort the array from lowest to highest based on keys. In this instance the key is the id from the database. Let me know if this is unclear, or if this isn't what you want.