Building search filters by passing parameters
Hiya,
I'm trying to build a search filter by cliking on headers of my table. So the order by clause of the query is built on the fly. I can't get the string to have more that 1 item. Can anyone help?
Thanks
Links:
<thead>
<td ><a href="?area=joblog/index&sort=jobname" >Title</a></td>
<td ><a href="?area=joblog/index&sort=jobdeadline" >Deadline</a></td>
<td ><a href="?area=joblog/index&sort=jobpriority" >Priority</a></td>
<td><a href="?area=joblog/index&sort=jobfor" >Customer</a></td>
</thead>
code:
<cfparam name="filter" default="">
<cfif isdefined("sort")>
<cfif listlen("filter") eq 1 >
<cfset filter = filter & ", " & sort>
<cfelse>
<cfset filter = sort>
</cfif>
<cfelse>
<cfset filter = "jobname">
</cfif>
<cfquery name="get" datasource="joblog">
SELECT *
FROM job
INNER JOIN
priority ON job.jobpriority = priority.priorityid
WHERE job.jobcomplete = 'false'
ORDER BY
#filter#
</cfquery>
