cyber_alchemist Posted September 29, 2013 Share Posted September 29, 2013 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 https://forums.phpfreaks.com/topic/282540-so-why-my-heredoc-statement-is-not-accepted-by-php/ Share on other sites More sharing options...
Ch0cu3r Posted September 29, 2013 Share Posted September 29, 2013 There is a trailing space after ENDHTML on line 22. Link to comment https://forums.phpfreaks.com/topic/282540-so-why-my-heredoc-statement-is-not-accepted-by-php/#findComment-1451764 Share on other sites More sharing options...
cyber_alchemist Posted September 29, 2013 Author Share Posted September 29, 2013 thanksĀ Link to comment https://forums.phpfreaks.com/topic/282540-so-why-my-heredoc-statement-is-not-accepted-by-php/#findComment-1451767 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.