Home
The Toolkit for Online Communities
17219 Community Members, 0 members online, 2025 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Development : Removing single quote from SQL variables : One Message

Forum OpenACS Development: Re: Removing single quote from SQL variables

Collapse
Posted by Matthew Geddert on

Although there are a number of ways of doing this, I like to use the template::util::tcl_to_sql_list proc. So from a list of forums_ids the select in the on_submit needs to be in quotes not curly braces:

# I am setting it here, but this list should be supplied by your form
set forumcheck [list 1241053 1240526 1242123 1241683]

db_foreach select_my_stuff "
   select name ....
    where forum_id in ([template::util::tcl_to_sql_list $forumcheck])
"

This converts forum_ids to '1241053','1240526','1242123','1241683' which is what you want.