The thing now is that my separate script I used on the website home page no longer pulls the recent topics. Here is the code that was working, and is now broken.
I cannot use an extension because this is outside phpBB just accessing the database. Thanks.
Code: Select all
<?php
$urlPath = "../forums";
include '/home/site/public_html/forums/config.php';
$table_topics = $table_prefix. "topics";
$table_forums = $table_prefix. "forums";
$table_posts = $table_prefix. "posts";
$table_users = $table_prefix. "users";
$link = mysqli_connect("$dbhost", "$dbuser", "$dbpasswd", "$dbname") or die("Could not connect");
$query = "SELECT t.topic_id, t.topic_title, t.topic_first_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, p.post_text, u.user_id, u.username
FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
WHERE t.topic_id = p.topic_id AND
f.forum_id = t.forum_id AND
f.forum_id <> '8' AND
p.post_id = t.topic_first_post_id AND
p.poster_id = u.user_id
ORDER BY p.post_id DESC LIMIT 20";
$result = mysqli_query($link, $query) or die("Query failed");
$num=mysqli_num_rows($result);
echo "<h2>Recent <a href='/forums/'>Forum</a> Discussions</h2>";
if ($num == "0") { echo "<li>There are currently no related topics in our forums. <a href='/forums/'>Post a new forum topic now</a>.</li>"; }
else {
$num=0;
print "<p>";
while ($row = mysqli_fetch_array($result, MYSQL_ASSOC)) {
$posttext = substr(strip_tags($row["post_text"]), 0, 325);
echo "<b><a href=\"https://www.example.com/forums/viewtopic.php?t=$row[topic_id]\">" .
$row["topic_title"] . "</a></b><br />" . $posttext . "..." . "<br /><br />";
$num++;
}
}
print "</p>";
mysqli_free_result($result);
mysqli_close($link);
?>