Week 7 Activity 2
Modify the getMovieList.php file and include links to display different types of movies:
MORE INFO ON THE NEXT PAGE
Each link should display a list of movies identified by that link. For example, your code
should display an output similar to the following when the Musical Movies link is clicked:
_______________________________________________________________
How to Submit back to me
Submit the edited getMovieList.php file back to me.
XXXXXXXXXXDrama Movies
XXXXXXXXXXAdventure Movies
XXXXXXXXXXAction Movies
$movieGenre);
Obtain data
$movieList = getAll($sql, $db, $parameterValues);
Use a table structure for displaying data
XXXXXXXXXXecho "List of {$movieGenre} Movies";
XXXXXXXXXXecho "
Title Genre
";
XXXXXXXXXXforeach( $movieList as $movie){
/* Each $movie is an associative a
ay. Keys are the same as the field names
XXXXXXXXXXused in the SQL statement: title and type. *
XXXXXXXXXXecho " {$movie['title']} {$movie['type']}
";
}
XXXXXXXXXXecho "";
} catch (PDOException $e) {
XXXXXXXXXXecho "E
or!: ". $e->getMessage() . "
";
XXXXXXXXXXdie();
}
}
?
prepare($sql) method returns an object.
*
$statement = $db->prepare($sql);
/* Execute prepared statement. The execute( ) method returns a resource object. *
$statement->execute($parameterValues );
/* Use the fetchAll( ) method to extract records from the result set.
*
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
return $result;
}
?>