예제 #1
0
function handlePUT(mysqli $conn)
{
    parse_str(file_get_contents("php://input"), $data);
    $book = new Book();
    $book->update($conn, $data['id']);
    $book->setTitle($data['title']);
    $book->setAuthor($data['author']);
    $book->setDesc($data['desc']);
}
예제 #2
0
파일: books.php 프로젝트: kfiatos/Bookstore
function handlePUT()
{
    $conn = Connection::startConnection();
    parse_str(file_get_contents("php://input"), $data);
    header('Content-type: application/json');
    $book = new Book();
    $book->setName($data['name']);
    $book->setAuthor($data['author']);
    $book->setDesc($data['opis']);
    $book->updateBook($conn, $data['id']);
    Connection::stopConnecion($conn);
}
예제 #3
0
include 'database_connection.php';
include 'classes/MediaItem.php';
include 'classes/Game.php';
include 'classes/Book.php';
include 'classes/Music.php';
include 'classes/Movie.php';
$game = new Game();
$game->setTitle('Watch Dogs');
$game->setDesc('Crappy shit wannabe hacker game');
$game->setRating(1);
$game->setTags(['dnt']);
print '<p>' . ($game->save() ? "Saving successful" : "Saving unsuccessful") . '</p>';
$book = new Book();
$book->setTitle('Momo');
$book->setDesc('Dreamy and so on');
$book->setRating(4);
$book->setTags(['tc']);
print '<p>' . ($book->save() ? "Saving successful" : "Saving unsuccessful") . '</p>';
$movie = new Movie();
$movie->setTitle('The big short');
$movie->setDesc('Capitalism');
$movie->setRating(3);
$movie->setTags(['tc', 'wtf']);
print '<p>' . ($movie->save() ? "Saving successful" : "Saving unsuccessful") . '</p>';
$music = new Music();
$music->setTitle('Bravo Hits 666');
$music->setDesc('Diabolic Bullshit');
$music->setRating(1);
$music->setTags(['dnt']);
print '<p>' . ($music->save() ? "Saving successful" : "Saving unsuccessful") . '</p>';