Theme table with select in Drupal 6

<?php
   
if($result = db_query('SELECT `jid`, `nid`, `type` , from_unixtime( ts ) AS `ts`, `flag`, concat(substring(schid, 1,2), "-", substring(schid, 3,2), "-", substring(schid, 5,2), " ", substring(schid, 7,2), ":", substring(schid, 9,2)) AS `schid` FROM `feeder_queue`;')) {
     
     
$header = array(t('Feed ID'), t('Time'), t('Flag'), t('Schedule ID'));
      while (
$data = db_fetch_object($result)) {
             
$row = array($data->nid, $data->ts, $data->flag, $data->schid);
             
$rows[] = $row;
      }
     
$table_schedules = theme('table', $header, $rows, $attributes = array(), $caption = NULL);
    }
   
    return
$table_schedules;
?>