Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-15-2004, 09:48 AM
WebProWorld Member
 

Join Date: Aug 2003
Location: UK
Posts: 77
poab RepRank 0
Default Syntax Help

Hi,

I have two small (I hope) related problems. I'm using ASP with vbscript (can't get out of that). If I coul duse javascript I'd be fine, but I'm a little inexperienced with vbscript, so any help gratefully received.

I'm building a form based on the contents of a database. I have a drop down menu (<select><option> etc.) I have a database, and each entry has (just for example) a name and a place. The drop down is populated by running through the database and adding an option for each entry. The idea is that the user can select a place that's in the database, and submit the form, getting the names back.

Here's the problem:

1)
If I have say, 'Arncott' as a place, no problem, because there's one entry. But if I have 'London' there's loads, and I end up with lots of identical options in my form. I have no idea how to use arrays in vbscript. Would the best way of doing it to be to run through the database, check if the place was already in the array and if not add it? If so how do I do that?

2)
I'd like to alphabetise it. I guess that's an array thing too. How would I go about that?

Thanks for any help/advice/tips/tutorials you know about.
Reply With Quote
  #2 (permalink)  
Old 04-15-2004, 11:18 AM
WebProWorld Pro
 

Join Date: Mar 2004
Location: Pittsburgh, PA, USA
Posts: 114
ChrisRC RepRank 0
Default

I think you're better off solving both of your problems on the database side rather than on the scripting side.

Do something like:

"SELECT city FROM mytable GROUP BY city ORDER BY city;"

That would return only 1 of each value for city in ascending alphabetic order.
Reply With Quote
  #3 (permalink)  
Old 04-15-2004, 12:56 PM
WebProWorld Member
 

Join Date: Aug 2003
Location: UK
Posts: 77
poab RepRank 0
Default

Thanks :)
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: ,



Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0