Exemplo n.º 1
0
function deleteCourses($secID)
{
    $sql = "DELETE enr FROM tblstudentenrollment enr\n\t\tJOIN tblstudent stu ON enr.intStudentID = stu.intStudentID\n\t\tWHERE enr.intSectionID = ? AND stu.strStudentEID = ?;";
    return dbPush($sql, "is", $secID, $_SESSION["cruser"]);
}
Exemplo n.º 2
0
function addCourse($stuID, $secID)
{
    $sql = "INSERT INTO tblstudentenrollment(intStudentID,intSectionID,strEnrollmentStatus) VALUES (?, ?, 'E');";
    return dbPush($sql, "ii", $stuID, $secID);
}
Exemplo n.º 3
0
            // Fix response data.  Replace empty strings with "null".
            $deptCode = fixInput($_POST["dept"]);
            $courseId = $deptCode . fixInput($_POST["courseId"]);
            $courseName = fixInput($_POST["courseName"]);
            $genEdCat = fixInput($_POST["genEdCat"]) == "" ? null : fixInput($_POST["genEdCat"]);
            $preReq = fixInput($_POST["preReq"]) == "" ? null : fixInput($_POST["preReq"]);
            $coReq = fixInput($_POST["coReq"]) == "" ? null : fixInput($_POST["coReq"]);
            $credits = fixInput($_POST["credits"]);
            $fee = fixInput($_POST["fee"]);
            $courseDesc = fixInput($_POST["courseDesc"]) == "" ? null : fixInput($_POST["courseDesc"]);
            // Check if record already exists
            $sql = "SELECT strCourseID FROM tblCourse WHERE strCourseID = ?";
            if (!dbGetExists($sql, "s", $courseId)) {
                // Record does not exist - add it!
                $sql = "INSERT INTO tblCourse VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
                $result = dbPush($sql, "ssssssids", $courseId, $courseName, $deptCode, $genEdCat, $preReq, $coReq, $credits, $fee, $courseDesc);
                if ($result) {
                    echo "Course '" . $courseName . "' added successfully!";
                }
                //else echo $result;
            } else {
                echo "That course ID already exists!";
            }
            break;
        default:
            // Request type was invalid
            echo "Bad request type";
            break;
    }
} else {
    // Request was not POST request