DB query for tabular results of all a db table's info I'm really having a hard time getting my head around the DB abstraction layer.

I've got a simple 2 column table and I'd like to output the values in the at table to a template.
I've seen plain php/mysqla  like this:

$result = db_query_range('SELECT age, savingvalues FROM {savingvalues} 21, 65);
while($row = mysql_fetch_array($result))
{
echo $row['age'] . " " . $row['factor'];
echo "&lt;br /&gt;";
}


and it's something like this I'd like to emulate, even if I have to strongarm it a bit, can anyone please help me figure this out? I'm in drupal 6

Thanks!

Steph
Use this table theming, next code created from comments below with some fixes:
    

  $header = array(
    array('data' =&gt; t('Age'), 'field' =&gt; 'age', 'sort' =&gt; 'asc'),
    array('data' =&gt; t('Savings'), 'field' =&gt; 'savingvalues'),
  );

  $result = pager_query("SELECT age, savingvalues FROM {savingvalues} " . tablesort_sql($header), 30);

  $data = array();
  while ($row = db_fetch_array($result)) {
    $data[] = $row;
  }
  $output .= theme('table', $header, $data);
  $output .= theme('pager');
?&gt;