Forum Creation Help?


#1

This is the forum code that I have already created but, when I search thru the book that I gotten with me it seem that it was correct but, when I went back and too double check my codes I have realized that I had gottten the error on line 19 sometimes when I change it around it like line 24 or 27 I cans screenshot more infomation and if somebody have the correct code for this please comment me below. Because I have no clue what I did wrong?

Here the image(s)
Screenshot_1

*Note: I kinda new between php and mysql…
Here the CODE

<?php include 'db_include.php'; doDB(); $get_topics_sql = "SELECT topic_id, topic_title, DATA_FORMATE(topic_create_time, '%b %e %Y at %r') AS fmt_topic_create_time, topic_owner FROM forum_topics ORDER BY 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) { $display_block = "

No topics exist .

"; } else { $display_block <<<END_OF_TEXT 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_num_posts_sql = "SELECT COUNT(post_id) AS post_count FROM forum_posts WHERE topic_id = '".$topic_id."'"; $get_num_posts_res = mysqli_query($mysqli, $get_num_posts_sql) of die(mysqli_error($mysqli)); while ($posts_info = mysqli_fetch_array($get_num_posts_res)) { $num_posts = $posts_info['post_count']; } $display_block .= <<<END_OF_TEXT END_OF_TEXT; } mysqli_free_result($get_topics_res); mysqli_free_result($get_num_posts_res); mysqli_close($mysqli); $display_block .= "
TOPIC TITLE # of POSTS
$topic_title
Created on $topic_create_time by $topic_owner
$num_posts
"; } ?> Topics in My Forum 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;}

Topics in My Forum

<?php echo $display_block; ?>

would you like to add a topic?