1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Best way to set up my DB

Discussion in 'Databases' started by bkflash, Dec 26, 2006.

  1. #1
    Hello, iam having a problem setting up my DB for my webpage, ill try to explain this situation the best way possible, the webpage iam building is a house seller webpage, the problem is iam now sure how i should layout the webpage. Only the admin can insert data into the DB. i have the login and admin area setup, now i just have layout the house's pages.

    right now here is my current DB layout for my houses.

    Field Type Collation Attributes Null Default Extra Action
    property_id int(11) No auto_increment
    h_type varchar(30) latin1_swedish_ci No
    u_description text latin1_swedish_ci No
    h_city varchar(50) latin1_swedish_ci No
    h_state char(2) latin1_swedish_ci No Na
    h_zipcode int(1) No 0
    featured enum('0', '1') latin1_swedish_ci No 0
    h_price varchar(30) latin1_swedish_ci No
    h_timestamp timestamp ON UPDATE CURRENT_TIMESTAMP No CURRENT_TIMESTAMP
    h_poster varchar(30) latin1_swedish_ci No
    h_title varchar(30) latin1_swedish_ci No

    Thats the basic information, what iam wondering is how can i get them to store informatin like this...

    Property Features

    --------------------------------------------------------------------------
    Single Family Property
    County: RILEY
    Year Built: 1933
    5 total bedroom(s)
    3 total bath(s)
    3 total full bath(s)
    Approximately 2593 sq. ft.
    Two story
    Master bedroom
    Living room
    Dining room
    Family room
    Kitchen
    Master bedroom is 13X11
    Living room is 19X14
    Dining room is 14X13
    Family room is 18X13 BR
    Kitchen is 15X7 + 12X9+
    Laundry room is 15X13
    Fireplace(s)
    1 car garage
    Central air conditioning
    Interior features: Clothes dryer, Clothes washer, Dishwasher, Disposal, Eat-in kitchen, Pantry, Range and oven, Refrigerator, Wood flrs
    Exterior features: Deck, Patio, Public sewer srvc, Public water supply, Wooded
    School District: 383MAN/OGD

    --------------------------------------------------------------------------
    That is without me having to make a individual field for each property avaible, is there an easier way?
     
    bkflash, Dec 26, 2006 IP
  2. robster

    robster Peon

    Messages:
    94
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I run g o o f f c a m p u s dot c o m

    I have found that the more fields in a table, the better, when it comes to real estate data. You should make a field for every imaginable peice of data that you will ever want to collect, and do it all from the get go, because changing your forms later on will be a huge headache!! Believe me, I have added fields twice now, and wish I had thought in advance a long long time ago.

    Many of those fields will be different types of values... for example, you can make a field called 'numofcars' of type tiny int, because you know they wont have more than 4. Same goes for fireplaces, beds, baths, ect.... You can make the field type accordingly.

    One other thing to keep in mind when creating a database for a project like this is that you must consider the method by which you will be collecting this data.

    If you are just scraping it from somewhere, then you might make a text field for laundryroomsize, and enter the "15x13" string directly. If users are inputting, then you might make it two fields, and then use that data to calculate a total sqft. later..... Get the point... You must think ahead as to how you are going to use it and how you are going to get it.

    THe only other option is to just have a medium text field that you would put that large text section in as, but that would be hard to use if you want to format the data differently, or search the data.
     
    robster, Jan 1, 2007 IP
  3. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #3
    Hmm... I am on the oposite end here. Normalize your data, only add fields when needed, and NEVER - I'm going to repeat this - NEVER do a select * because if you do, then you only have to modify one query that uses the data.

    Normalize, all queries require an ID as Int, and VarChar's are there for a reason :)
     
    ccoonen, Jan 4, 2007 IP