username = ENV['REMOTE_USER']

sth = dbh.execute('select grp from member where username like
"#{username}"')
   while row=sth.fetch do
    printf "%s<be />", row[0]
  end
  sth.finish

Good luck

Check the RubyMentor project: http://rubymentor.rubyforge.org/wiki/wiki.pl

On 2/22/07, peter <peter / iwebsl.com> wrote:
> Hi List
> I've spent the last couple days doing tutorials and so far I'm loving
> Ruby. My main function will be to use eruby on a web site.
>
> I've been able to get many things working but one I'm stumped on one so
> I'm hoping someone can point me in the right direction.
>
> I'm trying to use an ENV variable in a where statement as shown in the
> sample below. The problem is as soon as I use "" or '' around my var
> username the var stops working as a var. I know this must be so simple
> that the obvious is escaping me (it does work when I put a username in
> manually).
>
> Pleaseeeeeeee help :-)
>
>
> username = ENV['REMOTE_USER']
>
> sth = dbh.execute('select grp from member where username like
> "username"')
>     while row=sth.fetch do
>      printf "%s<be />", row[0]
>    end
>    sth.finish
>
>
> Regards,
> Peter
>
>
>