SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: database setup

  1. #1
    SitePoint Zealot
    Join Date
    May 2004
    Location
    houston
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question database setup

    well, in another post I asked for a project, and I received one.. To make a address book/phone book/date book type thing for users. So they login and can document all this information. Anyways, the only question I have is... how would I work the database?

    Should I make a table for each user? or would I just have very large fields for all their addresses, all their phone numbers, etc? This is the only thing that could pose a problem... Thanks for any guidance.

  2. #2
    Now with customized title Jump's Avatar
    Join Date
    Sep 2002
    Location
    The Restaurant at The End of The Universe
    Posts
    1,423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just have a table with addresses and phone numbers and such then have a user_id column to show who each address/phone number/etc belongs to.

  3. #3
    SitePoint Wizard
    Join Date
    Jul 2003
    Location
    Kent
    Posts
    1,921
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    No.

    It would be better to have a table for the addresses etc with an info_id as primary key, a table for the users with a user_id as primary key (and any other details that might be needed), and a table with the info_id and the user_id as a joint primary key, referencing the other two primary keys.

    That way if ten users all have the same person in "their" address book, the actual address is only stored once and only needs to be updated once, rather than having to find all the occurrences of j smith, J smith, jsmith, John smith, John Smith, J F Smith and J.F.Smith (who are actually the same person) and updating them all separately.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •