本文整理汇总了PHP中Rating::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Rating::update方法的具体用法?PHP Rating::update怎么用?PHP Rating::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rating
的用法示例。
在下文中一共展示了Rating::update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUpdateInvalidRating
/**
* test updating a rating that doesn't exist
*
* @expectedException InvalidArgumentException
*/
public function testUpdateInvalidRating()
{
// create a rating then try and insert it for the fail.
$rating = new Rating($this->trail->getTrailId(), $this->user->getUserId(), $this->INVALID_RATINGVALUE1);
$rating->update($this->getPDO());
}
示例2: Database
$database = new Database();
$db = $database->getConnection();
$originalOption = new Rating($db);
if (isset($_GET['id'])) {
$id = $_GET['id'];
$originalOption->Id = $id;
$originalOption->selectById();
}
if (isset($_POST['update'])) {
$updatedOption = new Rating($db);
$updatedOption->Id = $_POST['id'];
$updatedOption->Rating = $_POST['rating'];
$updatedOption->Comment = $_POST['comment'];
$updatedOption->Guest_Id = $_POST['guestid'];
$updatedOption->MenuOption_Id = $_POST['menuitemid'];
if ($updatedOption->update() == true) {
if ($_SESSION['accesslevel'] == 1) {
header("location:comments.php");
} else {
header("location:guest.php");
}
} else {
if ($_SESSION['accesslevel'] == 1) {
echo "<script>alert('There was an error updating this item');window.location = 'comments.php' </script>";
} else {
echo "<script>alert('There was an error updating this item');window.location = 'guest.php' </script>";
}
}
}
if (isset($_POST['delete'])) {
$updatedOption = new Rating($db);