Jump to content

advertising houses database


dark22horse

Recommended Posts

Hi guys,

 

Im starting a new project, just to help me get to grips with php and mysql!

 

I was hoping that some one could check my table designs, as im not sure they are quite right.

 

House//

 

House ID - Auto inc + unique

photo ID

User ID

summary

tenure

Type ID

Price

bedrooms

Reception rooms

bathrooms

county

town/city

condition

floor plan

details

post code

location type

chain

features

map

 

User//

 

user ID

Username

password

email

 

photos//

 

Photo ID

photo

 

type//

 

Type ID

Type

 

Is this normalised? I think I have done some of it, but not done this for a while, so cant quite remember!

 

 

 

Link to comment
Share on other sites

If you're House.PhotoID is only going to point to a record with a single other value, you might as well just store that other value in the House table.  However, what happens if I want to upload multiple pictures for a single house?  Your current design would require multiple duplicate records in the House table with only the PhotoID field changing.

 

I suggest removing PhotoID from the House table altogether.

 

Instead, change your Photo table to:

id

houseID

file

 

Then you will be able to upload multiple files for a single house.

Link to comment
Share on other sites

it is better to leave type as a table all of its own so you can restrict what the users can put in there, you can create a drop down select box of types you are allowing them by just querying that one table and placing the type_id in the house table

Link to comment
Share on other sites

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.