[Templates] Geez, how do I get single db value

Dennis Daupert ddaupert@csc.com
Wed, 6 Nov 2002 11:45:39 -0600


This is driving me nuts, cuz it should be a simple thing, but I don't
find it so. Reading the docs hasn't yet gotten me there, and I've tried
scores of
combinations, without success. Bummer.

I need to access a single field enty in the database and display
on my web page.

The login user's username is captured in the [% user %] tag, and
works nicely. This shows snitney, or whoever logs in.

But instead of 'Welcome snitney' I want to present the user with a
'Welcome, Skeeter' message, so need to retrieve the 'fname' field
from users table.

I can get the iterator to work:

[% USE DBI ('dbi:mysql:agendoo:hdeteam','agendoo'.'password') %]

[% FOREACH users = DBI.query('SELECT * FROM users') %]

<h3>Welcome, [% users.fname %]</h3>

[% END %]

but I haven't yet been able to figure out how to do a single SELECT
and return an fname to a variable that will display. What am I missing
here?

/dennis



---------------------------------------------------------------------------
Office phone: 817-762-8304

---------------------------------------------------------------------------
 "Great leaders never tell people how to do their jobs.
   Great leaders tell people what to do and establish a
         framework within which it must be done.
          Then they let people on the front lines,
       who know best, figure out how to get it done."
            ~ General H. Norman Schwarzkopf