function addLocations(Location $location, $child_id) { $connectionObject = Connection::getInstance(); $connection = $connectionObject->get_connection(); for ($i = 0; $i < 5; $i++) { $year = $location->getYear(); $grama_div = $location->getGramaDiv(); $polling_div = $location->getPollingDiv(); $polling_district = $location->getPollingDistrict(); $confirm = 0; $stmt = $connection->prepare("INSERT INTO location_duration_info (year, grama_div, polling_div , polling_district, confirm, child_id) VALUES (?,?,?,?,?,?)"); $stmt->bind_param("ssssii", $year, $grama_div, $polling_div, $polling_district, $confirm, $child_id); $result = $stmt->execute(); $stmt->close(); } }
//require_once($_SERVER['DOCUMENT_ROOT'] . "/kenneth/cs2102_admin/model/admin.php"); //require_once($_SERVER['DOCUMENT_ROOT'] . "/kenneth/cs2102_admin/model/database.php"); //require_once($_SERVER['DOCUMENT_ROOT'] . "/kenneth/cs2102_admin/model/location.php"); //require_once($_SERVER['DOCUMENT_ROOT'] . "/kenneth/cs2102_admin/controller/admin/authentication/index.php"); require_once $_SERVER['DOCUMENT_ROOT'] . "/cs2102/model/admin.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/cs2102/model/database.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/cs2102/model/location.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/cs2102/controller/admin/authentication/index.php"; use model\Admin; use model\Database; use model\Location; session_start(); AuthenticationController::authenticate(); $database = new Database(); $connection = $database->get_connection(); $locations = Location::get_all_location($connection); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Management System</title> <!-- stylesheets --> <link href="../../../stylesheet/reset.css" rel="stylesheet" type="text/css"> <link href="../../../stylesheet/icon.css" rel="stylesheet" type="text/css"> <link href="../../../stylesheet/default.css" rel="stylesheet" type="text/css"> <link href="../../../stylesheet/content.css" rel="stylesheet" type="text/css"> <!-- javascript --> <script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
public function set_location($location_name) { $location = new Location(); $location->set_name($location_name); $this->location = $location; }
public function delete() { $location = $_GET["location"]; Location::delete_location($location, $this->connection); header("Location: " . $_SERVER["HTTP_REFERER"]); }