That's a problem about variables scope, Xavier. the line: set row [ns_db select $db "select * from tadminoptype;"]
requires the variable $db to be set. That's done by the line: set db [ns_db gethandle "gamespool"] So to make the query work, you only need to add the line "set db ......" before the "set row ...." one. $db is the database handler you're using to do the queries. Regards, Juan José -- Juan José del Río | Comercio online / e-commerce (+34) 616 512 340 | [EMAIL PROTECTED] Simple Option S.L. Tel: (+34) 951 930 122 Fax: (+34) 951 930 122 http://www.simpleoption.com > set datasource [ns_db datasource $db] > set dbtype [ns_db dbtype $db] > set driver [ns_db driver $db] > set poolname [ns_db poolname $db] > set user [ns_db user $db] > set password [ns_db password $db] > > In file admin_op.tcl I do this: > On Tue, 2008-04-01 at 22:21 +0100, Xavier Bourguignon wrote: > Hi all, > > I have this in my config file: > ns_section "ns/server/games-admin/modules" > ns_param nssock $bindir/nssock.so > ns_param nslog $bindir/nslog.so > ns_param nscp $bindir/nscp.so > ns_param nsdb $bindir/nsdb.so > ns_param shared_tcl tcl > > ns_section "ns/db/drivers" > ns_param postgres nspostgres.so > > ns_section "ns/db/pools" > ns_param gameskillspool "Postgres" > > ns_section "ns/db/pool/gamespool" > ns_param Driver postgres > ns_param Connections 5 > ns_param DataSource localhost::games > ns_param User postgres > ns_param Password "secret" > ns_param Verbose On > ns_param LogSQLErrors On > ns_param ExtendedTableInfo On > ns_param Connection 5 > > ns_section "ns/server/games-admin/db" > ns_param Pools * > > I have the following in my db.tcl file: > set db [ns_db gethandle "gamespool"] > set datasource [ns_db datasource $db] > set dbtype [ns_db dbtype $db] > set driver [ns_db driver $db] > set poolname [ns_db poolname $db] > set user [ns_db user $db] > set password [ns_db password $db] > > In file admin_op.tcl I do this: > set row [ns_db select $db "select * from tadminoptype;"] > while { [ns_db getrow $db $row] } { > ns_log Notice "[ns_set get $row type] - [ns_set get $row desc]" > } > > The problem is that the code in admin_op does not work, I get this error: > can't read "db": no such variable > while executing > "ns_db select $db "select * from tadminoptype;"" > > But if I put this code in the db.tcl file, then it works fine. > > Can someone tell me if some settings are wrong, or if I am using ns_db > incorrectly? > > Thank you > -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.