function testconfirmBooking($idBooking) { global $mysqli; echo "<h1>Running Confirm Booking with Parameters:</h1>"; echo "idBooking = {$idBooking}"; confirmBooking($idBooking); $query = "SELECT confirmed FROM bookings WHERE id = {$idBooking}"; if ($stmt = $mysqli->prepare($query)) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($confirmed); $stmt->fetch(); $stmt->free_result(); $stmt->close(); if ($confirmed === 1) { echo '<p style="color:#008000"><b>Passed.</b></p>'; } else { echo '<p style="color:#800000"><b>Failed.</b></p>'; } } }
include 'storedInfo.php'; ini_set('display errors', 'On'); $mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname); if ($mysqli->connect_errno) { echo "Failure at MySQL Connection Step- " . $mysqli->connect_errno . ": " . $mysqli->connect_error; exit; } $babysitterid = $_GET["bsid"]; $confirmedget = $_GET["confirmed"]; $idget = $_GET["id"]; $result = $mysqli->query("SELECT firstName, lastName FROM babysitters WHERE id = '{$babysitterid}'"); $row = $result->fetch_assoc(); $sittername = $row["firstName"] . " " . $row["lastName"]; echo "<h1>Confirm Bookings for {$sittername}</h1>"; if ($confirmedget == 1) { confirmBooking($idget); } if ($confirmedget == 0) { rejectBooking($idget); } $booking = getBookings($babysitterid); if ($booking === 0) { echo "<p>There are no bookings for this babysitter</p>"; exit; } //Create select query $bookings_query = "SELECT b.starttime, b.endtime, b.confirmed, b.id, p.firstName, p.lastName, s.rate FROM bookings b INNER JOIN babysitters s ON b.idBabysitter = s.id INNER JOIN parents p ON b.idParent = p.id WHERE s.id = '{$babysitterid}'"; echo '<br />' . '<table>' . '<tr>' . '<th>Parent</th>' . '<th>Date/Time</th>' . '<th>Hours</th>' . '<th>Pay</th>' . '<th>Status</th>' . '</tr>'; if ($stmt = $mysqli->prepare($bookings_query)) { $stmt->execute(); $stmt->store_result();