Forum OpenACS Q&A: Help with TCL code

Collapse
Posted by Bob Powell on
I'm not sure if this is the right place to post this but I'll try anyway.

I have AOL server installed on my laptop and I have postgresql installed.  I can bring pages up locally through the AOL web server and I can connect to the databases via psql.

I have listed postgress as my database of choice in the AOL configuration file.  How can I tell whether of not AOL is talking to the database?

I have the following code in an ADP page:

<%

set db [ns_db gethandle]
set sql_query "select last_name from participants
                where participant_id = 1"
set selection [ns_db 1row $db $sql_query]
set last [ns_set get $selection "last_name"]
ns_return 50 text/plain "$last"

Nothing prints on the page.  Thanks for any help you can give in advance.

Collapse
2: Re: Help with TCL code (response to 1)
Posted by Jonathan Ellis on
I don't think you want to use ns_return in adp code.  Us ns_puts instead, or use the oacs templating system.  (Also oacs has a very nice database api rather than using raw ns_db calls.)