} } else { if (isset($_REQUEST["type"]) && trim($_REQUEST["type"]) == 'UPD') { $Id = strtoupper($_REQUEST['ID']); $Name = strtoupper($_REQUEST['Name']); $query = "update SalesPerson set Name = '" . $Name . "' where ID = '" . $Id . "'"; $result = mysql_query($query) or die("SQL Error 1: " . mysql_error()); if ($result == true) { getSuccessCreateResponse('Updated Successfully', $Id); } else { getErrorResponse("Update Failed!"); } } else { if (isset($_REQUEST["type"]) && trim($_REQUEST["type"]) == 'DEL') { $Id = strtoupper($_REQUEST['ID']); $In_Use = checkIDinUse('Students', 'SalesPerson', $Id); if ($In_Use == false) { $query = "delete from SalesPerson where ID = '" . $Id . "'"; $result = mysql_query($query) or die("SQL Error 1: " . mysql_error()); if ($result == true) { getSuccessCreateResponse('Deleted Successfully', $Id); } else { getErrorResponse("Delete Failed!"); } } else { getErrorResponse("Delete Failed! ID still in use."); } } else { $query = "SELECT * FROM SalesPerson order by ID"; $result = mysql_query($query) or die("SQL Error 1: " . mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$Phone = $_REQUEST['Phone']; $Mobile = $_REQUEST['Mobile']; $Expertise_Areas = $_REQUEST['Expertise_Areas']; $ASIC_Areas = $_REQUEST['ASIC_Areas']; $Referral = $_REQUEST['Referral']; $query = 'update Adviser set LicenseNo = "' . $LicenseNo . '", Practise_Name = "' . $Practise_Name . '", AR_Number = "' . $AR_Number . '", PostCode = "' . $PostCode . '", Given_Name = "' . $Given_Name . '", Surname = "' . $Surname . '", DOB = "' . $DOB . '", Email = "' . $Email . '", Phone = "' . $Phone . '", Mobile = "' . $Mobile . '", Expertise_Areas = "' . $Expertise_Areas . '", ASIC_Areas = "' . $ASIC_Areas . '",Referral = "' . $Referral . '" where ID = ' . $Id; $result = $mysqli->query($query); if ($result == true) { getSuccessCreateResponse('Updated Successfully', $Id); } else { getErrorResponse($query); } } else { if (isset($_REQUEST["type"]) && trim($_REQUEST["type"]) == 'DEL') { $Id = $_REQUEST['ID']; $In_Use = checkIDinUse($mysqli, 'Client', 'Adviser_ID', $Id); if ($In_Use == false) { $query = 'delete from Adviser where ID = ' . $Id; $result = $mysqli->query($query); if ($result == true) { getSuccessCreateResponse('Deleted Successfully', $Id); } else { getErrorResponse("Delete Failed!"); } } else { getErrorResponse("Delete Failed! ID still in use."); } } else { if (isset($_REQUEST["type"]) && trim($_REQUEST["type"]) == 'PROFILE') { $Id = $_REQUEST['ID']; $LicenseNo = $_REQUEST['LicenseNo'];
$Licensee = $_REQUEST['Licensee']; $Licensee_Email = $_REQUEST['Licensee_Email']; $query = "update Adviser_Groups set Group_Description = '" . $Group_Description . "', Licensee = '" . $Licensee . "', Licensee_Email = '" . $Licensee_Email . "' where ID = '" . $Id . "'"; $result = $mysqli->query($query); if ($result == true) { getSuccessCreateResponse('Updated Successfully', $Id); } else { getErrorResponse("Update Failed!"); } } else { if (isset($_REQUEST["type"]) && trim($_REQUEST["type"]) == 'DEL') { $Id = strtoupper($_REQUEST['ID']); if ($Id == 1) { getErrorResponse("Cannot delete System record."); } else { $In_Use = checkIDinUse($mysqli, 'Clients', 'Group_ID', $Id); if ($In_Use == false) { $query = "delete from Adviser_Groups where ID = '" . $Id . "'"; $result = $mysqli->query($query); if ($result == true) { getSuccessCreateResponse('Deleted Successfully', $Id); } else { getErrorResponse("Delete Failed!"); } } else { getErrorResponse("Delete Failed! ID still in use."); } } } else { if (isset($_REQUEST["type"]) && trim($_REQUEST["type"]) == 'LIST') { $query = "SELECT * FROM Adviser_Groups order by ID";
} } else { if (isset($_REQUEST["type"]) && trim($_REQUEST["type"]) == 'UPD') { $Id = strtoupper($_REQUEST['ID']); $Name = strtoupper($_REQUEST['Name']); $query = "update Instructor set Name = '" . $Name . "' where ID = '" . $Id . "'"; $result = mysql_query($query) or die("SQL Error 1: " . mysql_error()); if ($result == true) { getSuccessCreateResponse('Updated Successfully', $Id); } else { getErrorResponse("Update Failed!"); } } else { if (isset($_REQUEST["type"]) && trim($_REQUEST["type"]) == 'DEL') { $Id = strtoupper($_REQUEST['ID']); $In_Use = checkIDinUse('Course_Bookings', 'Instructor_No', $Id); if ($ID == 0) { getErrorResponse("Cannot delete System Record!"); } else { if ($In_Use == false) { $query = "delete from Instructor where ID = '" . $Id . "'"; $result = mysql_query($query) or die("SQL Error 1: " . mysql_error()); if ($result == true) { getSuccessCreateResponse('Deleted Successfully', $Id); } else { getErrorResponse("Delete Failed!"); } } else { getErrorResponse("Delete Failed! ID still in use."); } }
} } else { if (isset($_REQUEST["type"]) && trim($_REQUEST["type"]) == 'UPD') { $Id = strtoupper($_REQUEST['ID']); $Name = strtoupper($_REQUEST['Name']); $query = "update Boats set Name = '" . $Name . "' where ID = '" . $Id . "'"; $result = mysql_query($query) or die("SQL Error 1: " . mysql_error()); if ($result == true) { getSuccessCreateResponse('Updated Successfully', $Id); } else { getErrorResponse("Update Failed!"); } } else { if (isset($_REQUEST["type"]) && trim($_REQUEST["type"]) == 'DEL') { $Id = $_REQUEST['ID']; $In_Use = checkIDinUse('Course_Bookings', 'Boat_NO', $Id); if ($ID == 0) { getErrorResponse("Cannot delete System Record!"); } else { if ($In_Use == false) { $query = "delete from Boats where ID = '" . $Id . "'"; $result = mysql_query($query) or die("SQL Error 1: " . mysql_error()); if ($result == true) { getSuccessCreateResponse('Deleted Successfully', $Id); } else { getErrorResponse("Delete Failed!"); } } else { getErrorResponse("Delete Failed! ID still in use."); } }