Updated code:
if (isset($_POST['submit'])) {
/* Create a prepared statement */
$query = "INSERT INTO log_dates(week_date, crew_chief, monday_crew) values(?,?,?)";
$stmt = mysqli_prepare($connection, $query);
$returnedData = $_POST['data'];
foreach($returnedData as $data) {
$week_date = $data['week_date'];
$crew_chief = $data['crew_chief'];
$monday_crew = $data['monday_crew'];
$stmt->execute();
}
mysqli_stmt_bind_param($stmt, 'sss', $week_date, $crew_chief, $monday_crew);
/* Execute it */
mysqli_stmt_execute($stmt);
/* Close statement */
mysqli_stmt_close($stmt);
} // end if
Here's what my POST array looks like:
Array ( [0] => Array ( [week_date] => 2013-07-08 - 2013-07-14 ) [1] => Array ( [crew_chief] => Alan ) [2] => Array ( [monday_crew] => dd ) )
I have an idea for you. You need to have an idea on what are you doing.
First of all you need to develop a pure SQL query that you want to run against SQL server. Without prepared statements, without mysqli, without PHP. A clean SQL.
SQL is your problem now, not API to send it to server. And then eventually, step by step, go further with developing a program you need. Here is a rough checklist:
You may ask for help for the any stage from above but it's essential to follow the list. As it seems you are asking for the last item having not completed the first one.
Hope it helps.
That's not how you bind parameters. You're slapping your multiple parameters into a SINGLE value. The bind call should be
once the variables are bound, simply assigning new values to them will cause the next ->execute() call on the statement to pick up those new values.