Jump to content

So why my heredoc statement is not accepted by php ?


cyber_alchemist
Go to solution Solved by Ch0cu3r,

Recommended Posts

Having a parse error with my heredoc statement , so what is wrong with it ???



//retrieve information
$query = 'SELECT 
	movie_name, movie_year, movie_director, movie_leadactor, movie_type
	FROM 
		movie
	ORDER BY 
		movie_name ASC,
		movie_year DESC';
$result = mysql_query($query, $db) or die(mysql_error($db));

//determine the no. of rows in returned result
$num_movies = mysql_num_rows($result);

$table = <<<ENDHTML 

<div style="text-align: center" >
	<h2> Movie Review Database </h2>
	<table border="1" cellpadding="2" cellspacing="2" style="width: 70%; margin-left: auto; margin-right: auto;">
		<tr>
			<th>Movie Title</th>
			<th>Year of release</th>
			<th>Movie Director</th>
			<th>Movie Lead Actor</th>
			<th>Movie Type</th>
		</tr>
ENDHTML;

// loop through the result
while ($row = mysql_fetch_assoc($result)) {

	extract($row);
	
	$table .= <<<ENDHTML
	<tr>
		<td>$movie_name</td>
		<td>$movie_year</td>
		<td>$movie_director</td>
		<td>$movie_leadactor</td>
		<td>$movie_type</td>
	</tr>

ENDHTML;

}

$table .= <<<ENDHTML

</table>
</div>

<p align="center" >$num_movies Movies </p>

</div>

ENDHTML;

echo $table;

parse error : 'Parse error: syntax error, unexpected T_SL in table.php on line 22'

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.