Ejemplo n.º 1
0
        $imdbInsertQuery = "UPDATE `imdb` SET \n\t\t\t\tmetaCriticScore = '{$metascore}'\n\t\t\t\tWHERE movieId = '" . mysql_real_escape_string($movieId) . "'";
        if (IsEmpty($movieInfoRow['poster'])) {
            $posterQuery = "UPDATE `movieinfo` SET \n\t\t\t\t\t\tposter = '{$poster}'\n\t\t\t\t\t\tWHERE movieId = '" . mysql_real_escape_string($movieId) . "'";
            mysqli_query($conn, $posterQuery) or die(mysqli_error($conn));
        }
        if (!mysqli_query($conn, $movieInfoInsertQuery)) {
            die('Error: ' . mysqli_error($conn));
        }
        echo "movieinfo updated,  ";
        if (!mysqli_query($conn, $tomatoInsertQuery)) {
            die('Error: ' . mysqli_error($conn));
        }
        echo "tomato updated,  ";
        if (!mysqli_query($conn, $linksInsertQuery)) {
            die('Error: ' . mysqli_error($conn));
        }
        echo "links updated,  ";
        if (!mysqli_query($conn, $imdbInsertQuery)) {
            die('Error: ' . mysqli_error($conn));
        }
        echo "imdb updated,  ";
        echo "<br>";
        /*mysqli_query($conn, $movieInfoInsertQuery) or die(mysqli_error($conn));
        
        	          mysqli_query($conn, $imdbInsertQuery)or die(mysqli_error($conn));
        	          mysqli_query($conn, $linksInsertQuery)or die(mysqli_error($conn));
        	          mysqli_query($conn, $tomatoInsertQuery)or die(mysqli_error($conn));*/
    }
}
updateMovie();
Ejemplo n.º 2
0
if ($_GET['action'] == "add" || $_GET['action'] == "update") {
    $movie = array('movie_title' => $_POST['movieTitle'], 'genre' => $_POST['genre'], 'overview' => $_POST['movieoverview'], 'release_year' => $_POST['year'], 'poster_image' => $_POST['imgPoster'], 'backdrop_image' => $_POST['imgBackDrop'], 'trailer_link' => $_POST['trailerLnk'], 'imdb_rating' => $_POST['rating'], 'critics' => $_POST['critics'], 'audience' => $_POST['audience'], 'imdb_id' => $_POST['imdbcode'], 'stream_links' => $_POST['streamLinks'], "age_restrict" => $_POST['ageRestrict']);
    if ($_GET['action'] == "add") {
        $movie['added_date'] = $_POST['posted_date'];
        $query = addMovie($movie);
        //echo $query;
        $res = $db->insertGetLastID($query);
        if ($res > 0) {
            echo $res;
        } else {
            echo "-1";
        }
    } else {
        if ($_GET['action'] == "update") {
            $movie['updated_date'] = $_POST['updated_date'];
            $query = updateMovie($movie);
            $query .= " WHERE id='" . $_POST['id'] . "';";
            //echo $query;
            $res = $db->getaffectedRows($query);
            if ($res > 0) {
                echo "1";
            } else {
                echo "-1";
            }
        }
    }
} else {
    if ($_GET['action'] == "view") {
        $query = "SELECT * FROM mf_movies where id='" . escapeString($_POST['id']) . "'";
        $res = $db->query($query);
        $result = array();
Ejemplo n.º 3
0
/*
 * Returns all movies
 */
$app->get('/movies', function () use($app, $db) {
    listAllMovies($app, $db);
});
/*
 * Returns a movie
 */
$app->get('/movies/:id', function ($id) use($app, $db) {
    fetchMovie($id, $app, $db);
});
/*
 * Creates a new movie
 */
$app->post('/movies', function () use($app, $db) {
    addMovie($app, $db);
});
/*
 * Updates a movie
 */
$app->put('/movies/:id', function ($id) use($app, $db) {
    updateMovie($id, $app, $db);
});
/*
 * Deletes a movie
 */
$app->delete('/movies/:id', function ($id) use($app, $db) {
    deleteMovie($id, $app, $db);
});
$app->run();