File "ajax_action.php"
Full Path: /home/analogde/www/ToDo01/ajax_action.php
File size: 1.09 KB
MIME-type: text/x-php
Charset: utf-8
<?php
include_once 'config/Database.php';
include_once 'class/Records.php';
$database = new Database();
$db = $database->getConnection();
$record = new Records($db);
if(!empty($_POST['action']) && $_POST['action'] == 'listRecords') {
$record->listRecords();
}
if(!empty($_POST['action']) && $_POST['action'] == 'addRecord') {
$record->name = $_POST["name"];
$record->age = $_POST["age"];
$record->skills = $_POST["skills"];
$record->address = $_POST["address"];
$record->designation = $_POST["designation"];
$record->addRecord();
}
if(!empty($_POST['action']) && $_POST['action'] == 'getRecord') {
$record->id = $_POST["id"];
$record->getRecord();
}
if(!empty($_POST['action']) && $_POST['action'] == 'updateRecord') {
$record->id = $_POST["id"];
$record->name = $_POST["name"];
$record->age = $_POST["age"];
$record->skills = $_POST["skills"];
$record->address = $_POST["address"];
$record->designation = $_POST["designation"];
$record->updateRecord();
}
if(!empty($_POST['action']) && $_POST['action'] == 'deleteRecord') {
$record->id = $_POST["id"];
$record->deleteRecord();
}
?>