SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL 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 ASP Free Forums Sponsor:
  #1  
Old March 19th, 2004, 11:31 AM
wiltshireguyuk wiltshireguyuk is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 wiltshireguyuk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yahoo style directory

Hi.

I'm trying to write a directory like Yahoo in ASP using an Access database. I have three tables:

Companies - Contains all information about each company including a number which represents which catagory it is in.

Catagory Listing - Listing of all catagories with a unique number next to each one.

Subcatagories - Two fields, first catagory ID and second catagory ID, to allow multiple catagories within catagories.

It all works fine apart from when I'm deep inside multiple subcatagories, I can't see a way of finding the full catagory position (i.e. Shopping > Car & Motoring Accessories > Car Electronics).

I probably haven't explained this very well, but if anyone thinks they can help, it would be much appreciated. Thanks.

Andy.

Reply With Quote
  #2  
Old March 19th, 2004, 10:54 PM
dcarva's Avatar
dcarva dcarva is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 633 dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 9 h 18 m 20 sec
Reputation Power: 6
What do you mean exactly by:

I can't see a way of finding the full catagory position (i.e. Shopping > Car & Motoring Accessories > Car Electronics).

Reply With Quote
  #3  
Old March 20th, 2004, 10:21 AM
wiltshireguyuk wiltshireguyuk is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 wiltshireguyuk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by dcarva
What do you mean exactly by:

I can't see a way of finding the full catagory position (i.e. Shopping > Car & Motoring Accessories > Car Electronics).

I can't display the full path, because the database will only return the current catagory, not how you got to it. I have since written a new table (Paths), two columns, 1st: each catagory number, 2nd: each path step. It seems to work but it's basically duplicating the data in the subcatagory table. I also thought about doing a loop to step back through the subcatagory table, but I'm not sure if this is possible in SQL?

I have attached the database, even though it has very little data in it, hopefully it will explain itself.

Thanks.

Andy.
Attached Files
File Type: zip database.zip (41.4 KB, 252 views)

Reply With Quote
  #4  
Old March 20th, 2004, 11:00 AM
dcarva's Avatar
dcarva dcarva is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 633 dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 9 h 18 m 20 sec
Reputation Power: 6
"I can't display the full path, because the database will only return the current catagory"

Depending on how you join the tables, you can return any and all fields.

One thing that might help is to pass the id of each item the user clicks on. Ex:

Shopping -> Cars -> Radios

Each category above has a database id associated with it. Ex:

Shopping (Id 1) -> Cars (Id 5) -> Radios (Id 14)

When the user clicks on Shopping, pass Id to the receiving page. So now you have "1". When the user clicks on Cars, pass the id of shopping and cars(5). So now the receiving page has "1,5" When the user clicks on Radio, the query returns the id of Radios. So now you have "1,5,14". There is your path.

Does this makes sense? Hopefully I understand your question as well. Another thing, when joining records, you will get duplicates simply because of the nature of joins. But you can try using SELECT DISTINCT to only return distinct records.

Hope this helps.

Reply With Quote
  #5  
Old March 23rd, 2004, 11:08 AM
wiltshireguyuk wiltshireguyuk is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 wiltshireguyuk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the reply.

Quote:
Originally Posted by dcarva
"I can't display the full path, because the database will only return the current catagory"

Depending on how you join the tables, you can return any and all fields.
Except the full path without using the new Path table, unless it is possible to do some sort of loop to step back through each catagory, but I don't like the sound of that much..

Quote:
Originally Posted by dcarva
One thing that might help is to pass the id of each item the user clicks on. Ex:

Shopping -> Cars -> Radios

Each category above has a database id associated with it. Ex:

Shopping (Id 1) -> Cars (Id 5) -> Radios (Id 14)

When the user clicks on Shopping, pass Id to the receiving page. So now you have "1". When the user clicks on Cars, pass the id of shopping and cars(5). So now the receiving page has "1,5" When the user clicks on Radio, the query returns the id of Radios. So now you have "1,5,14". There is your path.
I preferbly wanted to avoid this method because of security. If someone starts manually changing the numbers it could put you in a valid catagory with an invalid path, which would cause alot of problems if they submit a site. I would still need to verify the full path somehow.

Quote:
Originally Posted by dcarva
Does this makes sense? Hopefully I understand your question as well. Another thing, when joining records, you will get duplicates simply because of the nature of joins. But you can try using SELECT DISTINCT to only return distinct records.
So far I don't think it's possible to get duplicate records, but I will keep it in mind for the future.

Andy.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Yahoo style directory


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 6 hosted by Hostway
Stay green...Green IT