Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Narrowing Search Results using SQL query

Author  Topic 

Swat12
Starting Member

3 Posts

Posted - 2008-06-25 : 13:07:39
Hey all, I am trying to narrow my search results by using a form with a text box and a 3 option drop down box. I need help with this because I am fairly new using sql. The link is http://dev.my.alfred.edu/index.cfm/fuseaction/workstudy.search.cfm

Here is my current code as well.

<CFQUERY NAME="GetJobs" DATASOURCE="#request.workstudydatasource#">
SELECT [ID], job, duties, hours, contact, [date] AS dateSubmitted, qual, avail, wrksty
FROM Jobs
WHERE job LIKE '#form.job#%'

<cfif Len((form.job))IS 0><!--- don't bother doing this if user didn't enter any keywords... --->
AND (job LIKE '%#form.job#%' OR duties LIKE '%#form.job#%')
</cfif>
ORDER BY [ID] DESC
</CFQUERY>





<cfoutput>
<p><strong>Search Results</strong><br />
Searched for <cfif Len((form.job)) IS 0>keywords "#HTMLEditFormat(form.job)#"</cfif>
and hours "#HTMLEditFormat(form.hours)#"</p>
</cfoutput>

<cfif GetJobs.RecordCount>
<cfinclude template="out_listjobs.cfm"/>
<cfelse>
<hr width="100%" size="1" color="#999933" />
<p>Sorry, your search didn't return any matches</p>
</cfif>

Swat12
Starting Member

3 Posts

Posted - 2008-06-25 : 13:24:02
All i need to know is how to set up the if statement for the drop down box. Someone please help?

so far this is my code for that. Im not sure what to put in after i declare each if.


<cfset form.hours = "workhours">
<cfif #workhours# = "various">

<cfelseif #workhours# = "1 to 5 hours/week">

<cfelseif #workhours# = "5 to 7 hours/week">

<cfelseif #workhours# = "over 7 hours/week">

</cfif>
Go to Top of Page

Swat12
Starting Member

3 Posts

Posted - 2008-06-26 : 13:14:23
Can anyone help me with this? This is really important and due tomorrow!!!!
Go to Top of Page
   

- Advertisement -