|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Search with Forms..
I'm trying to make it so users can search with forms for users.. so here is a narrowed down version of what i'm doing:
Battle Search:<br><br></center> Level: <input type="checkbox" name="1"> <input type="text" size="3" name="level"> HP: <input type="checkbox" name="2"> <input type="text" size="3" name="HP"><br> <input type="submit" value="Search!"> Both of these fields are in the 'Battle' table... So how would i do the query on the next page? <cfquery name="get_user" datasource="aeris7282"> Select <cfif #form.1# is NOT ''> Level </cfif> <cfif #form.2# is NOT ''> HP </cfif> From Battle </cfquery> But I don't understand how to incorporate the commas, ect... without doing something painful like.. <cfquery name="get_user" datasource="aeris7282"> Select <cfif #form.1# is NOT '' AND #form.2# is NOT ''> Level, HP <cfelse> Level </cfif> From Battle </cfquery> I would just use Select * since it's all from the same table.. but some of the fields i will be adding later on will not be in the same table, but that question will be addressed later ![]() |
|
#2
|
||||
|
||||
|
not sure what your prob is, but heres what i did for a member search
Code:
<CFQUERY NAME="Membersearch" DATASOURCE="#Datasource#">
SELECT * FROM Client
WHERE 0=0
<CFIF SESSION.Alas.Username IS NOT "">
AND Username LIKE '%#SESSION.Alas.Username#%'
</CFIF>
<CFIF SESSION.Alas.MembersState IS NOT "">
AND MembersState = '#SESSION.Alas.MembersState#'
</CFIF>
</CFQUERY>
|
|
#3
|
|||
|
|||
|
If you are still experiencing problems, can you elaborate more? Especially for
Quote:
I'm not sure what your concern is. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Search with Forms.. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|