Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8478041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:38:06+00:00 2026-06-10T18:38:06+00:00

I’m using the Zend Framework database relationships for a couple of weeks now. My

  • 0

I’m using the Zend Framework database relationships for a couple of weeks now. My first impression is pretty good, but I do have a question related to inserting related data into multiple tables. For a little test application I’ve related two tables with each other by using a fuse table.

      +---------------+      +---------------+      +---------------+
      |     Pages     |      |     Fuse      |      |    Prints     |
      +---------------+      +---------------+      +---------------+
      | pageid        |      | fuseid        |      | printid       |
      | page_active   |      | fuse_page     |      | print_title   |
      | page_author   |      | fuse_print    |      | print_content |
      | page_created  |      | fuse_locale   |      | ...           |
      | ...           |      | ...           |      +---------------+
      +---------------+      +---------------+

Above is an example of my DB architecture

Now, my problem is how to insert related data to two separate tables and insert the two newly created ID’s into the fuse table at the same time. If someone could could maybe explain or give me a topic related tutorial. I would appreciate it!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T18:38:08+00:00Added an answer on June 10, 2026 at 6:38 pm

    I assume you got separate models for each table. Then simply insert stuff in Prints table, store returned ID in variable. Then insert stuff in Pages table and store returned ID in another varialble. Eventually insert data in your Fuse table. You do not need any “at the same time” (atomic) operation here. ID of newly inserted rows are returned by save() (I assume you use autoincrement fields for this).

    $printsModel = new Application_Model_Prints();
    $pagesModel = new Application_Model_Pages();
    $fuseModel = new Application_Model_Fuse();
    
    $printData = array('print_title'=>'foo',
                  ...);
    $printId = $printsModel->insert( $printData );
    
    $pagesData = array('page_author'=>'bar',
                  ...);
    $pageId = $pagesModel->insert($pagesData);
    
    $fuseData = array('fuse_page' => $pageId,
                      'fuse_print' => $printId,
                      ...);
    $fuseId = $fuseModel->insert($fuseData);
    

    thus is pseudo code, so you may want to move inserts into your models and do somoe i.e. normalisation etc.

    I also suggest paying more attention to fields naming convention. It usually helps and now you got fuseid but also fuse_page. So it either should be fuse_id or fusepage (not to mention I suspect this field stores id so it would be fuse_page_id or fusepageid).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
This could be a duplicate question, but I have no idea what search terms
I have thousands of HTML files to process using Groovy/Java and I need to
I have a reasonable size flat file database of text documents mostly saved in
I have a view passing on information from a database: def serve_article(request, id): served_article

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.