[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Inserting multiple lines into MySQL table from a separate table

Posted on 2013-05-19
1
Medium Priority
?
139 Views
Last Modified: 2014-12-21
I have written written a fund raising campaign module for an application and need help with the final part.  There are three steps in this module and step three is where I'm running into problems.

This fund raising module is part of a larger collection of business modules available when a business logs into an account they have previously set up.

Step one of this module is to create a fund raising campaign. On a form page, the business member creates a fundraiser campaign by entering a name and start and end dates.  When submitted this campaign is entered into a table with this info as well as a unique ID and also collects the user name a unique ID of the business owner.

In step two, the business owner enters other companies that want to be sponsored by the member business to be a part of the fundraiser.  They are inserted into a second table that collects the fundraiser info, the sponsoring member business info and the new sponsored business info. There could be any number of sponsored businesses, five, ten twenty.

The third and final step is to add customers who want to join an opt-in birthday club.  The sponsoring business has a list that has been collected.  Each customer is entered with a name, birthday and email.

When submitted, the customer info needs to be inserted into the birthday club table for each business that had been entered in step two.

So if twenty companies signed on to the fundraiser, each would be inserted into the birthday club table for that customer.

I think that to accomplish this I need to query the table of sponsored companies and create an array to then insert into the birthday club table, along with the sponsoring company.

Any help and direction is appreciated.
0
Comment
Question by:TecTaoMC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 39180774
What you need is called a junction table (or similar term).  It is a table that typically contains a minimum of two columns, each being the keys of a row in another table.  By using this table you can establish a many-to-many relationship between elements in other tables, hence the name Relational Data Base.
http://en.wikipedia.org/wiki/Junction_table
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question