From: Hugh Sasse Date: 2008-10-24T00:24:50+09:00 Subject: Re: Iterating through a database result On Fri, 24 Oct 2008, Daniel Malcolm Webb [dbw] wrote: > Hi all, > > I've stumbled again. I'm currently trying to iterate though a result > output from PostgreSQL. Here's the database; I've been able to query > that I am getting all 5 records, however I don't seem to be able to > iterate through the second column i.e. 1,2,3,4,5. > > > > 7494;"1";"The origin (0,0) is top left.";TRUE;"1.0";"NOTE: Question > imported from map";"Correct.";; > > 7494;"2";"The origin (0,0) is top > right.";FALSE;"-0.25";"";"Incorrect.";; > [...] > > What I'm currently using is: > > num_options = res_qo.to_a.length > > puts num_options > > puts res_qo.to_a > > for i in (1..num_options) > > puts res_qo.to_ary[0][1] puts res_qo.to_a[i][1] > > end >