Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Arrays and Relationships

Options
  • 31-01-2009 7:55pm
    #1
    Closed Accounts Posts: 73 ✭✭


    Can you store arrays in a field where the field is in a relationship?


Comments

  • Registered Users Posts: 2,699 ✭✭✭samhail


    what language as a matter of interest ? sql ?
    direct relationship or with an index type field.

    can you do a relationship where the other field that it is related to is an array aswell ?


  • Closed Accounts Posts: 73 ✭✭Protype


    samhail wrote: »
    what language as a matter of interest ? sql ?
    direct relationship or with an index type field.

    can you do a relationship where the other field that it is related to is an array aswell ?


    sql....

    direct relationship or with an index type field.
    Not quite sure what you mean as im not at this to long.
    I think index! well it is listed in the index


  • Registered Users Posts: 2,781 ✭✭✭amen


    why would you want to store an array in a field?

    would be hard to sort and index
    in english what are you trying to do?


  • Closed Accounts Posts: 73 ✭✭Protype


    SO i need to get rid of the index for the array field! ye?

    In the form i send all information about a client which has qualification

    ADIT, ALS, DPP,

    the next may only have

    ADIT, DPP,


  • Registered Users Posts: 2,781 ✭✭✭amen


    better to have table called ClientQualification and with a
    ClientID Column and a Qualication Coulmn then if the client 1 has ADIT, ALS, DPP and client 55 has ADIT, DPP you would see
    1 ADIT
    1 ALS
    1 DPP
    50 ADIT
    50 DPP

    so now you have 5 rows instead of the 2 that you proposed but my way it is very easy to get a list of all clients with ADIT or ALS od DPP etc. You could also add a index on ClientIDQualifation

    The other advantage is that you way you prob have the array coloumn as varchar (255) or some other size. What happends if someone has more qualifications then the size of the fields?


  • Advertisement
  • Closed Accounts Posts: 73 ✭✭Protype


    I store the ids only
    so person 1 would have 1,2,3 and person 2 would have 1,2
    1 = ADIT
    2 = ALS
    3 = DPP


  • Closed Accounts Posts: 73 ✭✭Protype


    As i have drop down boxes in my form i have come across a problem

    If i select one selection from the FORM field and send to database Row/Field it works fine

    But if i select 2 or more from the FORM field (DROP DOWN BOX) and send it to the database it wont work,

    How is this done, i have checked my database and it is normalized.

    I have 9 tables
    1 master table
    8 parent tables

    I am trying to save the information into the master table. Information is sent by form.

    this is how it looks

    Tables
    master
    id name surname qual county
    1 joe blogs 1 1
    2 mary smith 2 9

    Qualifications
    id qual
    1 addi
    2 bafe
    3 tmei


Advertisement