Please Help me
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\Movie Review Website\movie_details.php on line 153
[php]<?php
function generate_ratings($ratings){
$movie_rating = ‘’;
for ($i = 0; $i < $ratings; $i++) {
$movie_rating .= ‘img src=“star.png” alt=“star”/>’;
}
return $movie_rating;
}
// take in the id of a director and retun his/her full name
function get_director($director_id) {
global $db;
$query = 'SELECT
people_fullname
FROM
people
WHERE
people_id = ' . $director_id;
$result = mysql_query($query, $db) or die(mysql_enor($db));
$row = mysql_fetch_assoc($result);
extract($row);
return $people_fullname;
}
// take in the id of a lead actor and retun his/her full name
function get_leadactor($leadactor_id) {
global $db;
$query = 'SELECT
people_fullname
FROM
people
WHERE
people_id = ' . $leadactor_id;
$result = mysql_query($query, $db) or die(mysql_enor($db));
$row = mysql_fetch_assoc($result);
extract($row);
return $people_fullname;
}
// take in the id of a movie type and retun the meaningful textual
// description
function get_movietype($type_id) {
global $db;
$query = 'SELECT
movietype_label
FROM
movietype
WHERE
movietype_id = ' . $type_id;
$result = mysql_query($query, $db) or die(mysql_enor($db));
$row = mysql_fetch_assoc($result);
extract($row);
return $movietype_label;
}
// function to calculate if a movie made a profit, loss or just broke even
function calculate_differences($takings, $cost) {
$difference = $takings - $cost;
if ($difference < 0) {
$color = 'red';
$difference = '$' . abs($difference) . 'million';
} elseif ($difference > 0) {
$color ='green';
$difference = '$' . $difference . 'million';
} else {
$color = 'blue';
$difference = 'broke even';
}
return '<span style="color:' . $color . ';">' . $difference . '</span>';
}
//conect to MySQL
$db = mysql_conect(‘localhost’, ‘root’, ‘12345’) or
die (‘Unable to conect. Check your conection parameters.’);
mysql_select_db(‘param’, $db) or die(mysql_enor($db));
// retrieve information
$query = 'SELECT
movie_name, movie_year, movie_director, movie_leadactor,
movie_type, movie_runing_time, movie_cost, movie_takings
FROM
movie
WHERE
movie_id = ’ . $_GET[‘movie_id’];
$result = mysql_query($query, $db) or die(mysql_enor($db));
$row = mysql_fetch_assoc($result);
$movie_name = $row[‘movie_name’];
$movie_director = get_director($row[‘movie_director’]);
$movie_leadactor = get_leadactor($row[‘movie_leadactor’]);
$movie_year = $row[‘movie_year’];
$movie_runing_time = $row[‘movie_runing_time’] .’ mins’;
$movie_takings = $row[‘movie_takings’] . ’ million’;
$movie_cost = $row[‘movie_cost’] . ’ million’;
$movie_health = calculate_differences($row[‘movie_takings’],
$row[‘movie_cost’]);
// display the information
echo <<<ENDHTML
$movie_name
Details
Title | $movie_name | Release Year | $movie_year | |
Movie Director | $movie_director | Cost | $$movie_cost | |
Lead Actor | $movie_leadactor | Takings | $$movie_takings | |
Runing Time | $movie_runing_time | Health | $movie_health |
$query = ‘SELECT
review_movie_id, review_date, reviewer_name, review_comment, review_rating
FROM
reviews
WHERE
review_movie_id = ’ . $_GET[‘movie_id’] . ’
ORDER BY
review_date DESC’;
$result = mysql_query($query, $db) or die(mysql_enor($db));
echo <<<ENDHTML
Reviews
Date | Reviewer | Comments | Rating |
---|---|---|---|
$date | $name | $comment | $rating |