php - Parse error: syntax error, unexpected end of file on line 90 -
i'm learning php , it's 2 days i've been blocked error "parse error: syntax error, unexpected end of file on line 90". i've checked cause , found may coming unclosed tag {,(,",' when verify found ok. i've deleted lines , wrote codes line line @ end found same error. @ point thought coming included file works in other file included. please me locate error!!
<?php include 'forum_include.php'; dodb(); //gather topics $get_topics_sql = "select topic_id, topic_title, date_format(topic_create_time, '%b %e %y @ %r') fmt_topic_create_time, topic_owner forum_topics order topic_create_time desc"; $get_topics_res = mysqli_query($mysqli, $get_topics_sql) or die(mysqli_error($mysqli)); if (mysqli_num_rows($get_topics_res) < 1) { //there no topics, so $display_block = "<p><em>no topics exist.</em></p>"; } else { //create display string $display_block = <<<end_of_text <table> <tr> <th>topic title</th> <th># of posts</th> </tr> end_of_text; while ($topic_info = mysqli_fetch_array($get_topics_res)) { $topic_id = $topic_info[topic_id]; $topic_title = stripslashes($topic_info[topic_title]); $topic_create_time = $topic_info[fmt_topic_create_time]; $topic_owner = stripslashes($topic_info[topic_owner]); //get number of posts $get_num_posts_sql = "select count(post_id) post_count forum_posts topic_id = '".$topic_id."'"; $get_num_posts_res = mysqli_query($mysqli, $get_num_posts_sql) or die(mysqli_error($mysqli)); while ($posts_info = mysqli_fetch_array($get_num_posts_res)) { $num_posts = $posts_info[post_count]; } //add display $display_block .= <<<end_of_text <tr> <td><a href="forum_showtopic.php?topic_id=$topic_id"> <strong>$topic_title</strong></a><br/> created on $topic_create_time $topic_owner</td> <td class="num_posts_col">$num_posts</td> </tr> end_of_text; } //free results mysqli_free_result($get_topics_res); mysqli_free_result($get_num_posts_res); //close connection mysql mysqli_close($mysqli); //close table $display_block .= "</table>"; } ?> <!doctype html> <html> <head> <title>topics in forum</title> <style type="text/css"> table { border: 1px solid black; border-collapse: collapse; } th { border: 1px solid black; padding: 6px; font-weight: bold; background: #ccc; } td { border: 1px solid black; padding: 6px; } .num_posts_col { text-align: center; } </style> </head> <body> <h1>topics in forum</h1> <?php echo $display_block; ?> <p>would <a href="forum_addtopic.html">add topic</a>?</p> </body> </html>
the end of second heredoc has space in front of it.
end_of_text;
remove space php recognize end of heredoc.
Comments
Post a Comment