We help IT Professionals succeed at work.
Get Started

How do I insert into multiple tables and add new information?

Last Modified: 2013-12-12
I have an insert record form to insert a record into tbl_series.  I also have a tbl_races.  When I insert a series, I want the action to insert 8 records into the tbl_races.  Furthermore, I want it to add future dates (of each Monday).  For example: I create a Winter series and put in a start date of the series.  I want the code to create 8 races numbered 1 through 8, with race week 1 using the start date of the series, race week 2 seven days later, race 3 seven days after that, etc.

This is the Dreamweaver created code for basic entry...where do I go next?

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO tbl_series (seriesID, seriesName, BeginDate, `Year`) VALUES (%s, %s, %s, %s)",
                       GetSQLValueString($_POST['seriesID'], "int"),
                       GetSQLValueString($_POST['seriesName'], "text"),
                       GetSQLValueString($_POST['BeginDate'], "date"),
                       GetSQLValueString($_POST['Year'], "int"));
Watch Question
Most Valuable Expert 2013
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE