Jump to content

Recommended Posts

I have been trying to get my head round database tables and how best to do this.........

 

I am building a dynamic site, and I want part of the site to have a "quicksearch" which consists of 2 dropdown lists.

List 1 is all the different counties

List 2 is a list of all the different specialities within that area,

so for example the user selects Derbyshire from the first drop down box and then chooses, lets for arguments sake say auto repair from the second drop down box, then press the search button.

I want the query to obviously only show auto repair in derbyshire and display these to the user.

The trouble I am having is getting my head around the databases and how many different tables to run with this.

I believe I am thinking to hard and missing an easier way of doing this.

If you want an idea of what I am looking for

 

goto

http://www.photographers.co.uk/

 

and then just under the images there is the same sort of thing of what I want in "find a photographer"

 

Like I say I dont need any help with coding, selecting databases etc just stuck in how the databases should be set up because at the minute I  keep going down the same road of "oh I will need 00's of tables for this", but surely this is not the case.

 

 

With thanks folkes

As far as I can tell you need three tables

 

table counties

countyID, name

----------------

1      , Avon

2      , Bedfordshire

3      , Berkshire

etc...

 

table specialities

specialtyID, name

-------------------

1          , auto repair

2          , plumber

etc..

 

table companies

companyID, countyID, specialityID, name

----------------------------------------

1        , 1      , 1          , Bob Avon's Auto Repairs

2        , 3      , 2          , Berkshire Plumbers Inc.

 

As you can see in table companies you have columns that indicate in which county and in what speciality given company is.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.