Ejemplo n.º 1
0
function magicalInsert($row)
{
    // send the appropriate data to insert customer
    $customer = array_slice($row, 0, 14, true);
    print_r("customer");
    print_r($customer);
    $CID = dbInsertNewCustomer($customer);
    // send the appropriate data to insert order
    $order = array_slice($row, 14, 19, true);
    print_r("order");
    print_r($order);
    $OID = dbInsertNewOrder($CID, $order);
    // send the appropriate data to insert items
    $products = array_slice($row, 33, 1, true);
    $items = $products["Products"];
    foreach ($items as $item) {
        print_r("item");
        print_r($item);
        dbInsertNewItem($OID, $item);
    }
}
function addCustomerToDataBase($data)
{
    $CID = dbInsertNewCustomer(formatForDataBase($data));
    return $CID;
}
function dbReplaceCustomer($row)
{
    return dbInsertNewCustomer($row, true);
}