Ewok wrote:
>
> <cfset UserList = "Userone,UserTwo,UserThree">
>
> <cfquery name="registeredusers" datasource="MyDSN">
> select Username, UserID from tbl__Users
> where Username IN ('#userlist#')
> order by Username
> </cfquery>
>
>
> does each item need single quotes and take the single quotes out of the query???
> if i hardcode the list in the query it needs single quotes around each one so Im assuming thats it. Is there an easy way to surrond each item with single quotes if thats the case?
Use cfqueryparam:
<cfset UserList = "Userone,UserTwo,UserThree">
<cfquery name="registeredusers" datasource="MyDSN">
select Username, UserID from tbl__Users
where Username IN (<cfqueryparam cfsqltype="cf_sql_varchar"
list="yes" value="#UserList#">)
order by Username
</cfquery>
Jochem
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
[Donations and Support]
- Re: Val function seems buggy Don
- Re: Val function seems buggy Michael Dinowitz
- Re: Val function seems buggy Sean Corfield
- Re: Val function seems buggy Claude Schneegans
- Re: Val function seems buggy Sean Corfield
- Re: Val function seems buggy Claude Schneegans
- Re: Val function seems buggy Michael Dinowitz
- Re: Val function seems buggy Jochem van Dieten
- RE: Val function seems buggy Jim Davis
- SELETCT IN (LISTOFSTRINGS) Ewok
- Re: SELETCT IN (LISTOFSTRINGS) Jochem van Dieten
- Re: SELETCT IN (LISTOFSTRINGS) Michael Dinowitz
- RE: SELETCT IN (LISTOFSTRINGS) Marlon Moyer
- Re: Val function seems buggy Don
- Re: Val function seems buggy Claude Schneegans
- Re: Val function seems buggy Claude Schneegans
- Re: Val function seems buggy S . Isaac Dealey
- Re: Val function seems buggy Michael Dinowitz
- Re: Val function seems buggy S . Isaac Dealey