print "ERROR !: " . $e->getMessage() . "<br/>";
            die;
        }
    }
    public function loadState($name)
    {
        try {
            $stmt = $this->db->prepare("SELECT state FROM `datatables_states` WHERE `name` LIKE :name");
            $stmt->execute(array(":name" => $name));
            $result = $stmt->fetch(PDO::FETCH_ASSOC);
            echo $result['state'];
        } catch (PDOException $e) {
            print "ERROR !: " . $e->getMessage() . "<br/>";
            die;
        }
    }
}
if (isset($_GET['action'])) {
    //start saving or loading
    $dbManager = new DbManager();
    switch ($_GET['action']) {
        case "save":
            if (isset($_POST['state'])) {
                $dbManager->saveState($_POST["name"], $_POST["state"]);
            }
            break;
        case "load":
            $dbManager->loadState($_POST["name"]);
            break;
    }
}