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

Closed Thread
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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old December 13th, 2004, 07:52 AM
bawaite bawaite is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 84 bawaite User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 50 m 45 sec
Reputation Power: 5
state/prov search

On site already developed is a building listing database table with a state/prov field.

on the site right now they have a few links in the navigation that selects all the building in a state by have the URL variable set to the 2 character format of the state or province and then does a search in the database using the query string of:

bState LIKE '%#url.state#%'

I have got it working so that it will display the buildings in that one location

What I need to do now thought is do a search for all other locations.

The table field stores the locations in a list format

ex: PE,CA,TX

There will only be a set number of locations that a user can choose using the navigation. So what the it needs to do is select any and all items that have NF or BC or AK...


but the list my also contain the location that is in the navigation.


Any suggestions?

Confused yet.

Reply With Quote
  #2  
Old December 13th, 2004, 08:36 AM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
i wouldn't pass them with URL.
suppose, on the first form, you have a field called 'State'.

on the processing page, all you need to do is

<cfquery name="getBuildings" datasource="yourSource">
SELECT * FROM yourTable
WHERE State IN (<cfqueryparam list="yes" value="#FORM.State#">)
</cfquery>

hope it helps....

Reply With Quote
  #3  
Old December 13th, 2004, 08:49 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
Yep, I'm confused.

But first, why are you using LIKE and not = (the equals operator)?

WHERE bState = #url.state#

Second, if you have a list of things you want to query for, you can use IN:

WHERE bState IN ('MA','NC','CA')
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #4  
Old December 13th, 2004, 09:12 AM
bawaite bawaite is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 84 bawaite User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 50 m 45 sec
Reputation Power: 5
In refrences to FALCONSEYE's replay:
This will work when there is only one item but I don't think it will work the best when the user chooses, the all other options from the navigation. all the links to the list will be comming from a navigation button and not a form, there is only 5 options that are required. all, 3 states, and all others.


In refrences to kiteless's replay:
The reason why I was useing 'LIKE' and not '= or IN' was with it beeing a list the '=' will not work and for some reason I kept on getting error with the IN option.

But with both of your replays I was able to come up with an option that will work

thank you.

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > state/prov search


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 | 
  
 

IBM developerWorks




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