Q:

display all cells in a mysql column

I need all values from a table column put into an assoc array. I am having trouble finding the answer.
the table is only six rows deep.
example:
|--id--|--name--|--A--|--B--|--C--|
|--01--|--xl33--| 1.30| 2.45| 4.40|

i would like to get an assoc array for column B
name[xl33]=2.45
name[xl34]=....and so on

The trick is that the form will tell the script which column to fetch. A,B,C,D,E,F OR G
I know i could re-format the table and accomplish what i want but I need it structured the way i have it.( i have left out some columns for simplicity)

A:

function return_column($letter){
    $result = mysql_query("SELECT name, $letter FROM example") or die(mysql_error());
    while($row = mysql_fetch_assoc( $result )) {
        $return[$row['name']] = $row[$letter];
    }
    return $return;
}

$results = return_column('A');
print_r($results);

