5 Replies Latest reply on Jun 18, 2008 1:43 PM by (Laurence_Lewis)

    Two Tables

    (Laurence_Lewis)
      Hi

      I have two tables in a database. I have set up a recordset using QUB to join them so I can create a dynamic list from the two tables. This works great.

      I would like to generate a form that will allow me to update all the elements from both tables. I tried the Insert into 2 tables function. However that works as an insert but thats not what I want to achieve.

      Could someone point me in the right direction on how to set the form up so when I click edit on the list mentioned above it launches the form with the updatable elements from both MySQL tables in the DB.

      Thanks

      Laurence
        • 1. Re: Two Tables
          Günter Schenk Level 4
          Hi Laurence,

          each ADDT insert/update/delete transaction (this applies to the respective form too) is mapped to one table exclusively; in Code View you´d see a line like this:

          // Add columns
          $ins_tablename->setTable("tablename");

          ...which sets a certain table for all subsequently declared $ins_tablename->addColumn - statements.

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Two Tables
            (Laurence_Lewis) Level 1
            Hi Günter

            Thanks, does that mean you can't update two tables from the same form or it would have to be manually tweaked addding a second

            $ins_tablename->setTable("tablename2");

            With corrisponding fields where the single update/delete buttons perform the task on click?

            Cheers

            Laurence
            • 3. Re: Two Tables
              Hello Günter,

              I want to do exactly the same : update two tables in one form using ADDT. There is only the "insert two tables" available on the ADDT menu. How can I do this ? Is it really impossible to update two tables in the same form with ADDT ?
              • 4. Re: Two Tables
                Günter Schenk Level 4
                Hi folks,

                regretfully there´s no "Update two tables" option available which would allow you to update two tables from the same form -- but it´s possible by adding a Custom Trigger (or Custom Transaction) and make it execute a custom SQL query.

                I know this approach is a bit tricky, however you can see some examples in the helpfile´s chapter "Custom transactions and triggers" -- in particular the topics "execute SQL queries" and "use transaction fields" should point you in the right direction.

                Good luck :-)

                Cheers,
                Günter Schenk
                Adobe Community Expert, Dreamweaver
                • 5. Re: Two Tables
                  (Laurence_Lewis) Level 1
                  Hi All

                  Well I'll just have to try that then :-)

                  Thanks for the tips Gunter.

                  Cheers

                  Laurence