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


PHP Movie::findMovieById方法代码示例

本文整理汇总了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");
}
开发者ID:Witoso,项目名称:cinema_app,代码行数:23,代码来源:addScreening.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();
开发者ID:Witoso,项目名称:cinema_app,代码行数:31,代码来源:showInfo.php

示例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);
         }
     }
 }
开发者ID:Witoso,项目名称:cinema_app,代码行数:20,代码来源:ScreeningFetcher.php


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