当前位置: 首页>>代码示例>>PHP>>正文


PHP Book::update方法代码示例

本文整理汇总了PHP中Book::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Book::update方法的具体用法?PHP Book::update怎么用?PHP Book::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Book的用法示例。


在下文中一共展示了Book::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testUpdate

 function testUpdate()
 {
     $title = "Anathem";
     $test_book = new Book($title);
     $test_book->save();
     $new_title = "crypotnomicon";
     $test_book->update($new_title);
     $this->assertEquals($new_title, $test_book->getTitle());
 }
开发者ID:umamiMike,项目名称:library-1,代码行数:9,代码来源:BookTest.php

示例2: handlePUT

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']);
}
开发者ID:RyszardRzepa,项目名称:REST_API,代码行数:9,代码来源:Books.php

示例3: testUpdate

 function testUpdate()
 {
     $book_name = "Siddhartha";
     $test_book = new Book($book_name);
     $test_book->save();
     $test_book->setTitle("Peace Train");
     $test_book->update();
     $result = Book::getAll();
     $this->assertEquals($test_book, $result[0]);
 }
开发者ID:JordanNavratil,项目名称:Library,代码行数:10,代码来源:BookTest.php

示例4: Book

 function test_update()
 {
     $title = "Three Blind Mice";
     $test_book = new Book($title);
     $test_book->save();
     $title2 = "Chicken Dog";
     $test_book->update($title2);
     $result = Book::getAll();
     $this->assertEquals([$test_book], $result);
 }
开发者ID:juliocesardiaz,项目名称:Library,代码行数:10,代码来源:BookTest.php

示例5: testUpdate

 function testUpdate()
 {
     //Arrange
     $book_name = "Intro to Art";
     $test_book = new Book($book_name);
     $test_book->save();
     //Act
     $new_book_name = "Intro to Fine Arts";
     $test_book->update($new_book_name);
     //Assert
     $this->assertEquals("Intro to Fine Arts", $test_book->getTitle());
 }
开发者ID:kevintokheim,项目名称:Library,代码行数:12,代码来源:BookTest.php

示例6: testUpdate

 function testUpdate()
 {
     //Arrange
     $title = "Harry Potter";
     $id = 1;
     $test_book = new Book($title, $id);
     $test_book->save();
     $new_title = "Moby Dick";
     //Act
     $test_book->update($new_title);
     //Assert
     $this->assertEquals("Moby Dick", $test_book->getTitle());
 }
开发者ID:bborealis,项目名称:library,代码行数:13,代码来源:BookTest.php

示例7: testUpdate

 function testUpdate()
 {
     //Arrange
     $title = "Where the Red Fern Grows";
     $id = null;
     $test_book = new Book($title, $id);
     $test_book->save();
     $new_title = "Where the Green Fern Dies";
     //Act
     $test_book->update($new_title);
     //Assert
     $this->assertEquals("Where the Green Fern Dies", $test_book->getTitle());
 }
开发者ID:jcubed22,项目名称:library-1,代码行数:13,代码来源:BookTest.php

示例8: updateBook

 public static function updateBook($id)
 {
     $params = filter_input_array(INPUT_POST);
     $attributes = array('id' => $id, 'name' => $params['name'], 'author' => $params['author'], 'publishyear' => $params['publishyear'], 'pages' => $params['pages'], 'description' => $params['description']);
     $book = new Book($attributes);
     $errors = $book->errors();
     if (count($errors) == 0) {
         $book->update();
         Redirect::to('/allbooks/' . $book->id, array('message' => 'Kirjaa on muokattu onnistuneesti!'));
     } else {
         View::make('book/edit_book.html', array('errors' => $errors, 'attributes' => $attributes));
     }
 }
开发者ID:mclantta,项目名称:Tsoha-Bootstrap,代码行数:13,代码来源:BookController.php

示例9: update

 public static function update($id)
 {
     $params = $_POST;
     $v = new Valitron\Validator($params);
     $v->rule('required', 'book_name');
     $v->rule('lengthBetween', 'book_name', 1, 50);
     $v->rule('required', 'writer');
     $v->rule('lengthBetween', 'writer', 1, 50);
     $v->rule('required', 'publisher');
     $v->rule('lengthBetween', 'publisher', 1, 50);
     $v->rule('numeric', 'published');
     $v->rule('required', 'published');
     $v->rule('lengthBetween', 'published', 1, 4);
     $attributes = array('id' => $id, 'book_name' => $params['book_name'], 'writer' => $params['writer'], 'publisher' => $params['publisher'], 'published' => $params['published'], 'genre' => $params['genre']);
     if ($v->validate()) {
         $book = new Book($attributes);
         $book->update();
         Redirect::to('/book/' . $book->id, array('message' => 'Kirjan tietoja on muokattu.'));
     }
 }
开发者ID:samiahl,项目名称:Tsoha-Bootstrap,代码行数:20,代码来源:book_controller.php

示例10: Book

    if ($_POST['action'] == 'submit') {
        if (isset($_POST['usertext'])) {
            $text = $_POST['usertext'];
            $book = new Book();
            $book->add($text);
        } else {
            echo "sorry you have to enter name and comment";
        }
    } elseif ($_POST['action'] == 'like') {
        if ($_POST['l_id']) {
            $id = $_POST['l_id'];
            $book = new Book();
            $book->like($id);
        }
    } elseif ($_POST['action'] == 'delete') {
        if ($_POST['d_id']) {
            $id = $_POST['d_id'];
            $book = new Book();
            $book->delete($id);
        }
    } elseif ($_POST['action'] == 'update') {
        if ($_POST['up_id']) {
            if ($_POST['new_comment']) {
                $new_comment = $_POST['new_comment'];
                $id = $_POST['up_id'];
                $book = new Book();
                $book->update($id, $new_comment);
            }
        }
    }
}
开发者ID:abdallah7,项目名称:drupia-training,代码行数:31,代码来源:action.php

示例11: switch

if (isset($_REQUEST["id"])) {
    $id = $_REQUEST["id"];
    $b = $book->getBookInfo($id);
    if (!$b) {
        $page->show404();
    }
    switch ($action) {
        case 'submit':
            $coverLoc = WWW_DIR . "covers/book/" . $id . '.jpg';
            if ($_FILES['cover']['size'] > 0) {
                $tmpName = $_FILES['cover']['tmp_name'];
                $file_info = getimagesize($tmpName);
                if (!empty($file_info)) {
                    move_uploaded_file($_FILES['cover']['tmp_name'], $coverLoc);
                }
            }
            $_POST['cover'] = file_exists($coverLoc) ? 1 : 0;
            $_POST['publishdate'] = empty($_POST['publishdate']) || !strtotime($_POST['publishdate']) ? $con['publishdate'] : date("Y-m-d H:i:s", strtotime($_POST['publishdate']));
            $book->update($id, $_POST["title"], $_POST['asin'], $_POST['url'], $_POST["author"], $_POST["publisher"], $_POST["publishdate"], $_POST["cover"]);
            header("Location:" . WWW_TOP . "/book-list.php");
            die;
            break;
        case 'view':
        default:
            $page->title = "Book Edit";
            $page->smarty->assign('book', $b);
            break;
    }
}
$page->content = $page->smarty->fetch('book-edit.tpl');
$page->render();
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:31,代码来源:book-edit.php

示例12: Book

 function test_update()
 {
     //Arrange
     $title = "World War Z";
     $genre = "Horror";
     $test_book = new Book($title, $genre);
     $test_book->save();
     $new_name = "Reginald Irving-Jones";
     //Act
     $test_book->update($new_name);
     //Assert
     $this->assertEquals($new_name, $test_book->getTitle());
 }
开发者ID:kellimargaret,项目名称:Library-Search,代码行数:13,代码来源:BookTest.php

示例13: testUpdate

 function testUpdate()
 {
     //Arrange
     $title = "Grapes of Wrath";
     $test_book = new Book($title);
     $test_book->save();
     $new_title = "Harry Potter";
     //Act
     $test_book->update($new_title);
     //Assert
     $this->assertEquals("Harry Potter", $test_book->getTitle());
 }
开发者ID:jtorrespdx,项目名称:library_catalog,代码行数:12,代码来源:BookTest.php

示例14: book_edit_form_submit

function book_edit_form_submit($data)
{
    $error = book_validate($data);
    if (!empty($error)) {
        return FALSE;
    } else {
        $book = new Book();
        $update = $book->update($data);
        if ($update['code'] == 200) {
            return book_list($data['id']);
        }
    }
}
开发者ID:enettolima,项目名称:mvno-platform,代码行数:13,代码来源:template_book.controller.php

示例15: Book

 function test_updateGenre()
 {
     //Arrange
     $title = "Whimsical Fairytales...and other stories";
     $genre = "Fantasy";
     $test_book = new Book($title, $genre);
     $test_book->save();
     $column_to_update = "genre";
     $new_info = "Historical Fiction";
     //Act
     $test_book->update($column_to_update, $new_info);
     //Assert
     $result = Book::getAll();
     $this->assertEquals("Historical Fiction", $result[0]->getGenre());
 }
开发者ID:r-hills,项目名称:library-1,代码行数:15,代码来源:BookTest.php


注:本文中的Book::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。