switch ($detail[0]) { case 0: //Custom Pizza $pizzaId = makeCustomPizza($detail[3], $detail[2]); //Size, ToppingArray makeOrderDetailPizza($orderId, $detail[1], $pizzaId); //orderId, Quantity, pizzaId break; case 1: //Specialty Pizza makeOrderDetailPizza($orderId, $detail[1], $detail[2]); //orderId, Quantity, pizzaId break; case 2: //Item makeOrderDetailItem($orderId, $detail[1], $detail[2]); //orderId, Quantity, pizzaId break; } } respond(0, $orderId); //echo $message; if ($removeData) { mysqli_query($GLOBALS["conn"], "TRUNCATE TABLE Pizza_Toppings;"); mysqli_query($GLOBALS["conn"], "TRUNCATE TABLE Order_Details;"); mysqli_query($GLOBALS["conn"], "TRUNCATE TABLE Pizza_Toppings;"); mysqli_query($GLOBALS["conn"], "DELETE FROM Pizza WHERE pizzaId > 9"); mysqli_query($GLOBALS["conn"], "TRUNCATE TABLE Orders;"); mysqli_query($GLOBALS["conn"], "TRUNCATE TABLE Student;"); } /**
echo "Pizza 3. result: " . ($pizza_3 != -1 ? "Success (id: {$pizza_3})" : "Failure") . "<br>"; echo "<br>"; //Create Order_Details for these 3 pizzas to connect them to the order echo "Making Details for the Pizzas<br>"; $detail_1 = makeOrderDetailPizza($orderId, $quantity_pizza_1, $pizza_1); $detail_2 = makeOrderDetailPizza($orderId, $quantity_pizza_2, $pizza_2); $detail_3 = makeOrderDetailPizza($orderId, $quantity_pizza_3, $pizza_3); echo "Pizza 1 detail result: " . ($detail_1 ? "Success" : "Failure") . "<br>"; echo "Pizza 2 detail result: " . ($detail_2 ? "Success" : "Failure") . "<br>"; echo "Pizza 3 detail result: " . ($detail_3 ? "Success" : "Failure") . "<br>"; echo "<br>"; //Create Order_Details for 3 items to connect them to the order echo "Making Details for the Items<br>"; $detail_1 = makeOrderDetailItem($orderId, $quantity_item_1, $items[0]); $detail_2 = makeOrderDetailItem($orderId, $quantity_item_2, $items[1]); $detail_3 = makeOrderDetailItem($orderId, $quantity_item_3, $items[2]); echo "Item 1 detail result: " . ($detail_1 ? "Success" : "Failure") . "<br>"; echo "Item 2 detail result: " . ($detail_2 ? "Success" : "Failure") . "<br>"; echo "Item 3 detail result: " . ($detail_3 ? "Success" : "Failure") . "<br>"; echo "<br>"; echo "totalcost: " . mysqli_fetch_array(mysqli_query($GLOBALS["conn"], "SELECT totalCost FROM Orders WHERE orderId=" . $orderId . ";"))["totalCost"]; if ($removeData) { mysqli_query($GLOBALS["conn"], "TRUNCATE TABLE Pizza_Toppings;"); mysqli_query($GLOBALS["conn"], "TRUNCATE TABLE Order_Details;"); mysqli_query($GLOBALS["conn"], "TRUNCATE TABLE Pizza_Toppings;"); mysqli_query($GLOBALS["conn"], "DELETE FROM Pizza WHERE pizzaId > 9"); mysqli_query($GLOBALS["conn"], "TRUNCATE TABLE Orders;"); mysqli_query($GLOBALS["conn"], "TRUNCATE TABLE Student;"); } ?>