ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 26th, 2005, 09:07 PM
charmed0rz charmed0rz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 142 charmed0rz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 49 m 31 sec
Reputation Power: 5
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

Reply With Quote
  #2  
Old May 7th, 2005, 03:23 AM
Alas's Avatar
Alas Alas is offline
Wickedwd.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: wickedwd.com
Posts: 187 Alas Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 17 h 32 m 22 sec
Reputation Power: 0
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>

Reply With Quote
  #3  
Old May 9th, 2005, 10:32 AM
Bastion Bastion is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 181 Bastion User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 4 h 25 m 11 sec
Reputation Power: 5
If you are still experiencing problems, can you elaborate more? Especially for

Quote:
Originally Posted by charmed0rz
But I don't understand how to incorporate the commas, ect...


I'm not sure what your concern is.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Search with Forms..


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT