Example #1
0
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>PHP Fiddle - Procedures</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="PHP Fiddle - Procedures">
    <meta name="author" content="bradyhouse">
  </head>

  <body>
        <?php 
include 'configuration.php';
include 'common.php';
include 'course.php';
$detailHTML = getCourseDetails($_GET['courseId']);
foreach ($detailHTML as $line) {
    echo $line . PHP_EOL;
}
?>
 <!-- /php -->

  </body>
</html>
         $Course_Date->modify('+1 day');
         $Course_Date->setTime(8, 30);
     }
     if ($result == true) {
         getSuccessCreateResponse('Dates Inserted Successfully', $Student_Cost);
     } else {
         getErrorResponse("Date add Failed!");
     }
 } else {
     if (isset($_REQUEST["type"]) && trim($_REQUEST["type"]) == 'ADD') {
         $StudentNo = $_REQUEST['StudentNo'];
         $Receipt_No = getnextReceiptNo();
         $Course_No = $_REQUEST['Course_No'];
         $Salesperson_No = strtoupper($_REQUEST['Salesperson_No']);
         $Course_Details = getCourseById($Course_No);
         $Lessons = getCourseDetails($Course_No);
         $GST_Amt = getCourseGSTAmt($Course_Details["Course_Cost"]);
         $Student_Cost = $Course_Details["Course_Cost"];
         if ($Course_Details["Ex_GST"] == "YES") {
             $Student_Cost = $Student_Cost + $GST_Amt;
         }
         $first_row = true;
         for ($i = 0; $i < count($Lessons); $i++) {
             $query = 'insert into Course_Bookings (StudentNo, Receipt_No, Booking_Date, Course_No, Lesson_No, Balance, Salesperson_No) values (' . $StudentNo . ', ' . $Receipt_No . ', now(),' . $Course_No . ', ' . $Lessons[$i] . ', ';
             if ($first_row == true) {
                 $query = $query . $Course_Details["Course_Cost"] . ', "' . $Salesperson_No . '")';
                 $first_row = false;
             } else {
                 $query = $query . '0, "' . $Salesperson_No . '")';
             }
             $result = mysql_query($query) or die("SQL Error 1: " . mysql_error());