Using a CFC, I've got a table of results from a getAllRecords method. I want to
filter those results based on some variables that the user clicks on
individually.
So, in the getAllRecords method, my SELECT query will be:
SELECT *
FROM table
WHERE value1 = #arguments.value1#
<cfif isDefined("arguments.value2")> AND value2 = #arguments.value2#</cfif>
<cfif isDefined("arguments.value3")> AND value3 = #arguments.value3#</cfif>
(cfqeryparam eliminated for this post. Rest assured, I'm using it.)
My question is, what's the most efficient way to collect and pass those three
variables as a group?
At first, I created a variable called URLVariables, and appended each variable
as the user clicked each one. That was nice, in that the user could build up
multiple filters with a few clicks. And, that saved time when adding new
filters, in that I did not have to change each link on the page and add a new
variable to a long list of varbiales joined by &.
However, that left me open to doubling-up on one variable, hence getting and
illegal WHERE clause:
WHERE value2 = A, B
(value2 is an integer)
There has to be a better way to do this. Any thoughts or experiences to speak
of?
Thanks,
Cameron
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:213419
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54