Late in the day and I've hit a wall. Any help is appreciated.

Heres what I have:


<%
dbh =
DBI.connect("dbi:blank:dbname=products;host=blank;blank","blank","blank")

sth = dbh.execute("SELECT * FROM products")

while row = sth.fetch_array do
        puts "<br></br>"
        puts "Column Name : #{sth.column_names[0]}"
        puts "Column Name : #{sth.column_names[1]}"
        puts "Column Name : #{sth.column_names[2]}"
        puts "<br></br>"

%>


Now, as long as I use puts "Column Name : #{sth.column_names[0]}" and
increment column_names by hand I get my data.

EX.
Array_Grid_Header  =["Column Name : #{sth.column_names[0]}" ,
                                "Column Name : #{sth.column_names[1]}"
,
                                "Column Name : #{sth.column_names[2]}"
,
                                "Column Name : #{sth.column_names[3]}"
,
                                "Column Name : #{sth.column_names[4]}"
];

Problem is, I need this to be dynamic so I can insert it into my array.
I am a C++ programmer and cannot figure out how to do this in RUBY.

Also, this is embedded Ruby code into JavaScript

what I need is something like this:

         for(var nCount = 0; nCount < <%=sth.column_names.size%>;
nCount++)
         {
            Array_Grid_Header +=
["<%=sth.column_names[nCount].upcase%>"];

         }

This would give me the Array in need, but it doesn't like nCount.

See....<%=sth.column_names.size%> in my f'or loop' produces 15.
I need fill Array_Grid_Header with the column names .

Thank you in advance.