address book question

Results 1 to 2 of 2

Thread: address book question

  1. #1
    Join Date
    Dec 1969

    Default address book question

    i have a address book in my web page where<BR>you see all the data of your contacts here<BR>well<BR>there is lecturer contact table<BR>(e.g,the staff number:AA1001(Primary key)<BR>there is Personal contact table <BR>(for personal i use auto number)<BR><BR>when i select which contact that i want to<BR>add to a group <BR>i can choose between personal and lecturer<BR>and i keep all these info in these tables<BR><BR>groups<BR>group_id<BR>group_desc<BR> <BR>group_members<BR>group_id<BR>members(can be the staff no or the personal_id)<BR><BR>when i insert,it comes out like this<BR>group_id members<BR> 7 AA10001(staff_number from lecturer table)<BR> 7 14(this id from personal table)<BR> 7 18<BR> 7 AA90009<BR><BR><BR>i think this is not a good idea to use right<BR>becoz i`m having trouble retrieving the group<BR>members names espcially when there is lecturers<BR>and personal id both exists in the group_member<BR>table<BR><BR><BR>how do i make this better?<BR>i want it to be as flexible as possible<BR>so that users can choose from lecturers<BR>and also from personal and group them in <BR>one group

  2. #2
    Join Date
    Dec 1969

    Default RE: address book question

    Yes that is a bad idea<BR><BR>the way you have it right now, you can have a personal_id and exactly same lecturer_id coexist in the group_members table. <BR>This would make your data-retrieval very difficult. well you could get away with that by adding a field to the group_members table which says person_type. say a lecturer could have a person_type = 1 and personal could have person_type = 2. <BR><BR>but thinking of that in a long term basis, what I would do is have a user table having common fields from tbllecturer and tblpersonal<BR><BR>user_id (PK)<BR>name<BR>uname<BR>password<BR><BR>lecturer table would have<BR>lecturer_id(PK)<BR>user_id(FK)<BR>...<BR>. ..<BR><BR>personal table<BR>personal_id(PK)<BR>user_id(FK)<BR>...<BR> ...<BR><BR>so in my group table, i would have the user_id instead of lecturer_Id or personal_id<BR><BR>just a thought...

Posting Permissions

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