0 Replies Latest reply on Apr 2, 2008 4:08 AM by (Olle_Karneman)

    one to many? problems

      Hi.

      I,m trying to combine two tables into one. Table 1 is persons. Table two is movies. Table to insert in is, lets say per_mov_table

      I'm building a form that will get values from both tables 1 and 2 and insert into a new one.
      In that form I can select a person from a dropdown list. And select movies from a select list. Its
      possible to select multiple movies per person.

      I,m trying with the ADDT behaviors. but I get some strange results.

      Lets say I select person nr 2 and movies 2,3 and 4 in the form. Then I would expect results in new table to be something like: (id_fk_pers id_fk_mov are the foregin keys)

      id_per_mov_table    id_fk_pers    id_fk_mov
      
      1                                   2                       2
      2                                   2                       3
      3                                   2                       4


      instead the output is:

      id_per_mov_table    id_fk_pers    id_fk_mov
      
      1                                   2                       1
      2                                   77                      2
      3                                   77                      3
      4                                   77                      4


      First it inserts a new row with som bogus value that I dont know where it comes from
      Then it seemes that the id_fk_pers have som sort of autoincrement because if I do the same insert again I get

      id_per_mov_table    id_fk_pers    id_fk_mov
      
      1                                   2                       1
      2                                   80                      2
      3                                   80                      3
      4                                   80                      4


      So id_fk_pers is not getting the person id from the persons table. it is linked together with pers_id and id_fk_pers.

      So what am I to do? I'm desperate to get this working.

      I dont care how to do it but the goal is to show a detail page with one person and many movies with a ?pers_id link from another page.

      Regards
      Olle

      ps. sorry for the long post