Returning a db query for select options in webform I am trying to return dynamic select options for a webform component.  I have it working to return node titles, but I need to instead return values from a manually created table in the db that is not drupal related.  How would I alter this function to achieve that?

function _MY_MODULE_get_rate_options() {
    $nodes = array();
    $select = db_query("MY DB QUERY HERE");
    foreach ($select as $node) {
        $nodes[$node-&gt;nid] = $node-&gt;title;
    }
    return $nodes; 
}
If you're creating a select list then you only need two fields from the database, so you can use the excellent fetchAllKeyed() method of the database query. This will let you get your results in a single line of code:

function _MY_MODULE_get_rate_options() {
  return db_query('SELECT id, name FROM {my_table}')-&gt;fetchAllKeyed();
}


The result is an array keyed by the first field (id) with values from the second field (name).