Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search result with some criteria

Status
Not open for further replies.

paradis222

Programmer
Oct 20, 2002
12
0
0
HK
What i should started to make a page for searching the result in the database with some criteria? say, I have Name, Age, Sex and Location in the database, i wanna make a page which can filter the data from the database which the user can select the searching criteria first and then the searching condition. for example, the user have select "Age" and "Location" for the searching criteria, and then they have key in the searching condition like age above 12 and Hong Kong for location.

Can anyone give me a brief how to do it? Many thanks!
 
You could have radio buttons for critera (Age, Location, etc)
Then a search box for criteria. Post the form and the processing page will look something like:

<cfquery name=&quot;GetInfo&quot; Datasource=&quot;SomeSource&quot;>
SELECT #form.criteria#, otherField
FROM tableName
WHERE #form.criteria# LIKE %#Form.criteria#%
</cfquery>

As long as the criteria form field name matches table columns.

DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top