You should be able to pull it off with three tables. The first one
defines the categories.

Categories
---------------
CategoryID (PK)
Name
Description
etc.

The next one defines what fields are associated with each category.

CategoryFields
--------------------------
FieldID (PK)
CategoryID (FK -> Categories)
FieldName

The last one defines the values for each field in each ad.

AdFieldValues
----------------------
ID (PK)
AdID (FK -> Ads)
FieldID (FK -> CategoryFields)
Value

Okay, maybe four tables if you count the existing Ads table.

Ads
-----
AdID (PK)
CategoryID (FK -> Categories)
etc.

So each ad (Ads) belongs to a category (Categories) which has one or
more fields (CategoryFields). Thus each ad has one or more fields and
a value for each field (AdFieldValues).

That works if each field is plain text (<input type="text">) and
you're not doing anything fancy with the data (like searching for
homes between $125,000 - $150,000). Before you get too far involved
you might want to see if you can find a CMS that does all of this for
you.

Patrick


On 11/24/06, Doug Brown <[EMAIL PROTECTED]> wrote:
> I am in the process of re-designing a classifieds system and was just 
> wondering a few things. Currently there is just one standard for to fill out 
> for the ads. I am thinking of designing it to where it is more useful. I 
> would like to make the form as dynamic as possible by having different inputs 
> for different categories of items. The thing is, that I would imagine I would 
> need to have a databse table for each category. Am I correct in this 
> assumption? Building the forms would be the easy part, but having say 50 
> different tables of info for all categories would be a nightmare. Any 
> suggestion would be appreciated.
>
> IE:
>
> [Real Estate Form]
>
> Price
> Bedrooms
> Bathrooms
> Garage
> Sq. Ft.
> Acreage
> Covenants
> etc. etc.
>
> [Auto Form]
>
> Make
> Model
> Year
> Miles
> etc. etc.
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:261636
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to