|
Tuesday, 02 March 2010 21:22 |
// description of your code here
$_SESSION['order_id'] = mysqli_insert_id($conn);
//This is adding any additional contact numbers to the contact_numbers table if the user added additional contact numbers
if($_SESSION['contact']) {
foreach ($_SESSION['contact'] as $counter => $contact_array) { //This specifies the $_SESSION['order'] array to loop through
foreach ($contact_array as $key => $value) { //This specifies the array within the $_SESSION['order'] array
$extra_number[$counter][$key] = $value;
$contact_sql = 'INSERT INTO contact_numbers (order_id, contact_type, int_prefix, prefix, first, last) VALUES (?, ?, ?, ?, ?, ?)';
$type = $extra_number[$counter]['additional_contact'];
$int_prefix = $extra_number[$counter]['additional_int_prefix'];
$prefix = $extra_number[$counter]['additional_prefix'];
$first = $extra_number[$counter]['additional_first'];
$last = $extra_number[$counter]['additional_last'];
if($stmt->prepare($contact_sql)){
$stmt->bind_param('isiiii', $_SESSION['order_id'], $type, $int_prefix, $prefix, $first, $last);
$contact_done . $counter = $stmt->execute();
}
} //end foreach
} //end of outer foreach loop
}//end if session[contact]
 Read more: |