本文整理汇总了PHP中Movie::findMovieById方法的典型用法代码示例。如果您正苦于以下问题:PHP Movie::findMovieById方法的具体用法?PHP Movie::findMovieById怎么用?PHP Movie::findMovieById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Movie
的用法示例。
在下文中一共展示了Movie::findMovieById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Movie
<?php
require_once "../classes/Database.php";
require_once "../classes/Screening.php";
require_once "../classes/Movie.php";
require_once "../classes/Cinema.php";
if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST["movie"])) {
$movieId = $_POST["movie"];
$cinemaId = $_POST["cinema"];
$dateFormatted = str_replace("T", " ", $_POST["date"]);
$db = DATABASE::getInstance();
$mysqli = $db->getConnection();
$movie = new Movie($mysqli);
$movie->findMovieById($movieId);
$cinema = new Cinema($mysqli);
$cinema->findCinemaById($cinemaId);
$screening = new Screening($mysqli);
$screening->setMovie($movie);
$screening->setCinema($cinema);
$screening->setDate($dateFormatted);
$screening->addToDatabase();
header("location: adminPanel.php");
}
示例2: Movie
<a href="index.php" class="btn btn-default">Go to the main site</a>
<?php
require_once "classes/Database.php";
require_once "classes/Movie.php";
require_once "classes/Cinema.php";
require_once "classes/ScreeningFetcher.php";
require_once "classes/Screening.php";
require_once "includes/ticketForm.php";
if ($_SERVER["REQUEST_METHOD"] === "GET" && $_GET["type"] === "movie") {
$id = $_GET["id"];
$db = DATABASE::getInstance();
$mysqli = $db->getConnection();
$movie = new Movie($mysqli);
$movie->findMovieById($id);
$movieName = $movie->getName();
$movieRating = $movie->getRating();
$movieDesc = $movie->getDescription();
echo "<h3>Title: {$movieName}</h3>";
echo "<p>Rating: {$movieRating}</p>";
echo "<h3>Description:</h3>";
echo "<p>{$movieDesc}</p>";
echo "<h3>Movie Screenings:</h3>";
$fetcher = new ScreeningFetcher($db);
$fetcher->getMovieScreenings($id);
$screeningsArray = $fetcher->getArrayWithMovieScreenings();
if (!empty($screeningsArray)) {
echo "<ul>";
foreach ($screeningsArray as $screening) {
$cinemaName = $screening->getCinema()->getName();
示例3: getCinemaScreenings
public function getCinemaScreenings($id)
{
$sqlQuery = "SELECT id, cinema_id, movie_id, date FROM screenings WHERE date > NOW() AND cinema_id = {$id} ORDER BY date ";
$conn = parent::getConnection();
$result = $conn->query($sqlQuery);
if ($result->num_rows > 0) {
while (list($id, $cinemaId, $movieId, $date) = $result->fetch_array(MYSQLI_NUM)) {
$movie = new Movie($conn);
$movie->findMovieById($movieId);
$cinema = new Cinema($conn);
$cinema->findCinemaById($cinemaId);
$screening = new Screening($conn);
$screening->setMovie($movie);
$screening->setCinema($cinema);
$screening->setDate($date);
$screening->setId($id);
$this->setArrayWithCinemaScreenings($screening);
}
}
}