davidspeare Posted March 14, 2007 Share Posted March 14, 2007 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 More sharing options...
The Little Guy Posted March 14, 2007 Share Posted March 14, 2007 echo "$movie_header" change to: echo "$movie_header"; Link to comment https://forums.phpfreaks.com/topic/42748-parse-error/#findComment-207440 Share on other sites More sharing options...
davidspeare Posted March 14, 2007 Author Share Posted March 14, 2007 That eliminated my parse error...and it was dumb, but the data from line 39 down is not displaying as I would expect it to. I know that the records are being read because the $echo "$num_movies"; variable on line 17 is returing the correct count. Link to comment https://forums.phpfreaks.com/topic/42748-parse-error/#findComment-207448 Share on other sites More sharing options...
davidspeare Posted March 14, 2007 Author Share Posted March 14, 2007 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 More sharing options...
davidspeare Posted March 15, 2007 Author Share Posted March 15, 2007 Anyone able to help here? Link to comment https://forums.phpfreaks.com/topic/42748-parse-error/#findComment-208240 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.