/Users/johnr/Desktop/IA pdf Downloads/_New Projects Downloads May 7th/CS_IA_Mattew/InsertData.class.php
 1 <?php
 2 require_once 'MySQLConn.class.php';
 3 
 4 class InsertData extends MySQLConn {
 5     private $conn;
 6     public function __construct(){
 7         $this->conn = $this->connect();
 8     }
 9     public function insertInquiryData($inquiry, $destination){
10         $destinations = $destination->getChosenDestination();
11         $arrivalDate = $inquiry->getArrivalDate();
12         $departureDate = $inquiry->getDepartureDate();
13         $days = $inquiry->getNumberOfDays();
14         $nights = $inquiry->getNumberOfNights();
15         $sql = "INSERT INTO inquiry (Destinations, ArrivalDate, DepartureDate, Days, Nights) VALUES (?, ?, ?, ?, ?)";
16         $stmt = $this->conn->prepare($sql); 
17         $stmt->bind_param("sssss", $destinations, $arrivalDate, $departureDate, $days, $nights);
18         if($stmt->execute()){
19             return $stmt->insert_id;
20         }else{
21             return false;
22         }
23     }
24     public function insertCustomerData($inquiryID, $customer){
25         $firstName = $customer->getFirstName();
26         $middleName = $customer->getMiddleName();
27         $LastName = $customer->getLastName();
28         $email = $customer->getEmail();
29         $phoneNumber = $customer ->getPhoneNumber();
30         $nationality = $customer->getNationality();
31         $location = $customer->getLocation();        
32         $sql = "INSERT INTO customers (InquiryID, FirstName, MiddleName, LastName, Email, PhoneNumber, Nationality, Location) VAlUES (?, ?, ?, ?, ?, ?, ?, ?)";       
33         $stmt = $this->conn->prepare($sql);
34         $stmt->bind_param("ssssssss",$inquiryID, $firstName, $middleName, $LastName, $email, $phoneNumber, $nationality, $location);
35         if($stmt->execute()){
36             return true;
37         }else{
38             return false;
39         }
40     }
41     public function insertDailyPlanData($inquiryID, $dailyPlan, $dayNumber){
42         $golfCourse = $dailyPlan->getGolfCourse();
43         $teeTime = $dailyPlan->getTeeTime();
44         $caddie = $dailyPlan->getCaddie();
45         $cart = $dailyPlan->getCart();
46         $hotel = $dailyPlan->getHotel();
47         $hotelBreakfast = $dailyPlan->getHotelBreakfast();
48         $transportation = $dailyPlan->getTransportation();
49         $sql = "INSERT INTO day_plans (InquiryID, DayNumber, GolfCourse, TeeTime, Caddie, Cart, Hotel, HotelBreakfast, Transportation) VAlUES ((?), ?, ?, ?, ?, ?, ?, ?, ?)";
50         $stmt = $this->conn->prepare($sql); 
51         $stmt->bind_param("sssssssss",$inquiryID, $dayNumber, $golfCourse, $teeTime, $caddie, $cart, $hotel, $hotelBreakfast, $transportation);
52         if($stmt->execute()){
53             return true;
54         }else{
55             return false;
56         }
57     }
58 }