示例#1
0
文件: index.php 项目: prottoy/Notes
        } else {
            $this->retrieveAllNotes();
        }
    }
    function deleteNote($_id)
    {
        //This will delete the note with id
        $sql = "DELETE FROM notes WHERE id = '{$_id}'";
        if ($this->conn->query($sql)) {
            $data = array('Status' => 'Success', 'message' => 'deleted Successfully', 'debug' => $sql);
            echo json_encode($data);
        } else {
            $data = array('Status' => 'Failure', 'message' => 'delete failure', 'debug' => $sql);
            echo json_encode($data);
        }
    }
    function updateNote($_id, $_title, $_description)
    {
        //This will delete the note with id
        $sql = "UPDATE notes SET title='{$_title}',note='{$_description}' WHERE id='{$_id}';";
        if ($this->conn->query($sql)) {
            $this->retrieveAllNotes();
        } else {
            $this->retrieveAllNotes();
        }
    }
}
// MARK :- NOTE METHODS
$notes = new Notes($servername, $username, $password, $dbname);
$notes->enableDebug();
$notes->service();