I have a site which which will sort articles into numerous categories.

The user selects the categories via checkboxes (currently 9, it will grow).

Articles may be in more than one category.

There are over 5000 articles and growing at several 100 a month.

The easiest solution would be an articleDisplay table

ARTICLEDISPLAY
articleDisplayID
articleID
articleCategoryID
isDisplayed

will one record for each category

EXAMPLE:

articleDisplayID---articleID---articleCategoryID---isDisplayed
1---------------------1001-----------1-----------------0
2---------------------1001-----------2-----------------1
3---------------------1001-----------3-----------------1
4---------------------1001-----------4-----------------0
5---------------------1001-----------5-----------------0
6---------------------1001-----------6-----------------1
7---------------------1001-----------7-----------------0
8---------------------1001-----------8-----------------0
9---------------------1001-----------9-----------------1
10---------------------1002-----------1-----------------0
11---------------------1002-----------2-----------------0
12---------------------1002-----------3-----------------1
...
etc....

Now this will lead to a fairly big table. Currently it would be 5000
articles by 9 categories. It will soon be 10,000 articles by 15 categories.

So, the solution seems to be to only put articles to be displayed into the
table.

Here's the problem: How does one display all the categories and CHECK the
categories where the article will be displayed.

The following displays all the categories and a corresponding checkbox.

<cfoutput query="showCategories">

#categoryName#<br/>
<input type="checkbox" name="categories">

</cfoutput>

I'm blocking on how to show the selected categories in the above output.

How does one get AND DISPLAY all categories

<cfquery name="showCategories">

SELECT *
FROM categories

</cfquery>

but select the checkboxes with

<cfquery name="showChecked">

SELECT *
FROM display
WHERE article=#SOME_GET_VARIABLE#

</cfquery>

I hope this wasn't too long and confusing :-)

Gil
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to