Jump to content

Parse Error


davidspeare

Recommended Posts

Does anyone see why I am getting the following error in the code below?

 

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' on line 39

 

<?php

 

include "config.php";

 

$link = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

 

mysql_select_db('test');

 

 

$query = "SELECT movie_name, movie_director, movie_leadactor " .

"FROM movie";

 

 

$result = mysql_query($query, $link) or die (mysql_error());

$num_movies = mysql_num_rows($result);

 

echo "$num_movies";

 

 

//LINE 20

 

$movie_header=<<<EOD

<h2><center>Movie Review Database</center></h2>

<table width="70%" border = "10" cellpadding="2" cellspeacing="2"

align= "center">

<tr>

  <th>Movie Title</th>

<th>Year of Release</th>

  <th>Movie Director</th>

  <th>Movie Lead Actor</th>

  <th>Movie Type</th>

</tr>

</table>

EOD;

 

echo "$movie_header"

//LINE 38

$movie_details =  '' ;

while ($row = mysql_fetch_array($result)) {

  $movie_name = $row['movie_name'];

  $movie_director = $row['movie_director'];

  $movie_leadactor = $row['movie_leadactor'];

 

  $movie_details .=<<<EOD

  <tr>

    <td>$movie_name</td>

    <td>$movie_director</td>

    <td>$movie_leadactor</td>

  </tr>

EOD;

}

 

$movie_details .=<<<EOD

  <tr>

    <td> </td>

  </tr>

  <tr>

    <td>Total :$num_movies Movies</td>

  </tr>

EOD;

 

 

?>

Link to comment
https://forums.phpfreaks.com/topic/42748-parse-error/
Share on other sites

Sorry to be <i> that new guy</i> but i can not see why my detail are not falling into a table.  The $movie_header is executing fine, but the $movie_details are not dumping into the table, they are just being displayed in one row under the header...

 

<?php

 

include "config.php";

 

$link = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

 

mysql_select_db('test');

 

 

$query = "SELECT movie_name, movie_director, movie_leadactor " .

  "FROM movie";

 

 

$result = mysql_query($query, $link) or die (mysql_error());

$num_movies = mysql_num_rows($result);

 

 

 

//LINE 20

 

$movie_header=<<<EOD

<h2><center>Movie Review Database</center></h2>

<table width="70%" border = "10" cellpadding="2" cellspeacing="2"

  align= "center">

<tr>

  <th>Movie Title</th>

<th>Year of Release</th>

  <th>Movie Director</th>

  <th>Movie Lead Actor</th>

  <th>Movie Type</th>

</tr>

</table>

EOD;

 

//echo "$movie_header";

 

//LINE 38

$movie_details =  '' ;

while ($row = mysql_fetch_array($result)) {

  $movie_name = $row['movie_name'];

  $movie_director = $row['movie_director'];

  $movie_leadactor = $row['movie_leadactor'];

 

  $movie_details .=<<<DETAILS

  <tr>

    <td>$movie_name</td>

    <td>$movie_director</td>

    <td>$movie_leadactor</td>

  </tr>

DETAILS;

}

 

$movie_details .=<<<EOD

  <tr>

    <td> </td>

  </tr>

  <tr>

    <td>Total :$num_movies Movies</td>

  </tr>

EOD;

 

$movie_footer = "</table>";

 

$movie =<<<MOVIE

$movie_header

$movie_details

$movie_footer

MOVIE;

 

echo "There are $num_movies in the database";

echo $movie;

 

?>

Link to comment
https://forums.phpfreaks.com/topic/42748-parse-error/#findComment-207521
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.