Defined in packages/acs-core/10-database-procs.tclUsage: db_foreach statement_name sql [-bind ns_set | list of bind variables] code_block [if_no_rows if_no_rows_code_block]
Performs the SQL query $sql, executing code_block once for each row with variables set to column values.
Example:
db_foreach greeble_query "select foo, bar from greeble" {
ns_write "<li>foo=$foo; bar=$bar\n"
} if_no_rows {
# This block is optional.
ns_write "<li>No greebles!\n"
}
- Parameters:
-
statement_name
sql