Passing Parameters between Database tables ??

2002-11-05 Thread Ian Vaughan
Hi 

I would really appreciate some advice on this problem I am having please, and would 
very much appreciate any advice/guidance on the best way to achieve.

I have a database table with  id, doctitle, docsummary and three fields called 
category1, category2 and category3.

The category1 field contains values such as E-mail, Servers etc in each record.

The category 2 field will contain values based on what the user has selected from the 
first category1, so for example if the user selected e-mail in category1 then 
category2 would have values such as Microsoft Exchange, POP3 etc. and the same from 
category3 field, the user selects these from a select list 

The user populates these fields through cascading select boxes using the 'onchange' 
function in javascript the laues of which are populated from a seperate table called 
category_menu..

That was just a bit of background.

Now this is my current problem, in my first cfm page (tutorials.cfm) to display the 
top level categories works well, , I am using the following query and output shown 
below. This brings back all the data contained in category_menu table.

If the user clicks on the Server link for example they are taken to more options 
related to the Server field, when they click this second field they are taken to 
listings based on the second selection, (so the information is tree structured in the 
table) 

So would I would like to know is when the user reaches the bottom level in the tree 
and click that link they are taken to a listing of documents from the itdocs table 
(mentioned above) 

Do you use a cfif statement in the tutorial.cfm code below? sending the user to 
another cfm detail page with the query

CFQUERY name=links datasource=v8
SELECT *
FROM itlinks
WHERE category3='#URL.category#'
/CFQUERY

Is this actually possible or are there other ways of achieving the above? I hope you 
are following me?? The main code is shown below and is working, just need to find out 
how to build this last piece in to display the information from the itdocs table from 
the URL.category

Thanks

Ian

-TUTORIAL.CFM---

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN

html
head
 titleUntitled/title
 CFQUERY name=query1 datasource=intranetv8
SELECT 
* from category_menu
where parent_level=
(select catno from category_menu where category='#URL.category#')
/CFQUERY
/head

body
  cfoutput query=query1


  
a 
href=http://intranet.neath-porttalbot.gov.uk/testpages/itnet/test.cfm?category=#category#;
 class=homeaa#category#/a 
br
Description here 
br
/cfoutput
BR





/body
/html 




~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.



RE: Passing Parameters between Database tables ??

2002-11-05 Thread Mark A. Kruger - CFG
Ian,

Thanks for trying to explain what you are doing so thoroughly - that always
helps.  However, in this case I'm not sure I'm following you. You have 3
columns in the same table that cascade - category1's value determines the
value of category2 etc.  I think that you might want to split off the
categories into lookups and cross reference tables.  It seems to me you have
a one to many relationship...


1 id to many (possibly) category1's
1 category1 to many category 2's

...etc.

This seems to make the case for some relational tables - which in turn would
hand off some of the problems you are having to the database constraints.
It seems quite a bit more difficult to implement this in the application
code.

-mk

-Original Message-
From: Ian Vaughan [mailto:i.vaughn;neath-porttalbot.gov.uk]
Sent: Tuesday, November 05, 2002 10:11 AM
To: CF-Talk
Subject: Passing Parameters between Database tables ??


Hi

I would really appreciate some advice on this problem I am having please,
and would very much appreciate any advice/guidance on the best way to
achieve.

I have a database table with  id, doctitle, docsummary and three fields
called category1, category2 and category3.

The category1 field contains values such as E-mail, Servers etc in each
record.

The category 2 field will contain values based on what the user has selected
from the first category1, so for example if the user selected e-mail in
category1 then category2 would have values such as Microsoft Exchange, POP3
etc. and the same from category3 field, the user selects these from a select
list

The user populates these fields through cascading select boxes using the
'onchange' function in javascript the laues of which are populated from a
seperate table called category_menu..

That was just a bit of background.

Now this is my current problem, in my first cfm page (tutorials.cfm) to
display the top level categories works well, , I am using the following
query and output shown below. This brings back all the data contained in
category_menu table.

If the user clicks on the Server link for example they are taken to more
options related to the Server field, when they click this second field they
are taken to listings based on the second selection, (so the information is
tree structured in the table)

So would I would like to know is when the user reaches the bottom level in
the tree and click that link they are taken to a listing of documents from
the itdocs table (mentioned above)

Do you use a cfif statement in the tutorial.cfm code below? sending the user
to another cfm detail page with the query

CFQUERY name=links datasource=v8
SELECT *
FROM itlinks
WHERE category3='#URL.category#'
/CFQUERY

Is this actually possible or are there other ways of achieving the above? I
hope you are following me?? The main code is shown below and is working,
just need to find out how to build this last piece in to display the
information from the itdocs table from the URL.category

Thanks

Ian

-TUTORIAL.CFM---

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN

html
head
 titleUntitled/title
 CFQUERY name=query1 datasource=intranetv8
SELECT
* from category_menu
where parent_level=
(select catno from category_menu where category='#URL.category#')
/CFQUERY
/head

body
  cfoutput query=query1



a
href=http://intranet.neath-porttalbot.gov.uk/testpages/itnet/test.cfm?categ
ory=#category# class=homeaa#category#/a
br
Description here
br
/cfoutput
BR





/body
/html





~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm