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
https://forums.phpfreaks.com/topic/60078-advertising-houses-database/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.