Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8213359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:05:21+00:00 2026-06-07T11:05:21+00:00

first of all: I’m a complete newbie if it comes to PHP scripting, so

  • 0

first of all: I’m a complete newbie if it comes to PHP scripting, so I just grabbed this script off a website, with the author saying it worked perfectly.

 <?php
// How Many Topics you want to display?
$topicnumber = 5;
// Scrolling towards up or down?
$scroll = "up";
// Change this to your phpBB path
$urlPath = "/forum";

// Database Configuration (Where your phpBB config.php file is located)
include 'forum/config.php';

$table_topics = $table_prefix. "topics";
$table_forums = $table_prefix. "forums";
$table_posts = $table_prefix. "posts";
$table_users = $table_prefix. "users";
$link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
mysql_select_db("$dbname") or die("Could not select database");

$query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id,
p.post_id, p.poster_id, p.post_time, 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 t.topic_status = 2 AND p.post_id = t.topic_last_post_id AND p.poster_id = u.user_id ORDER BY p.post_id DESC LIMIT $topicnumber";
$result = mysql_query($query) or die("Query failed");

echo "
";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "
";
}
print "

" .
$row["topic_title"] .
"    by: " .
$row["username"] .
"   
" .
date('F j, Y, g:i a', $row["post_time"]) .
"
";
mysql_free_result($result);
mysql_close($link);
?>

Although when I use it, it gives me a weird as heck output being “by: December 31, 1969, 7:00 pm”. Instead of (the only topic it should find now) “Test1 by: Cruciatum July 8th, 2012, 10pm”.

Anyone who can figure out what’s wrong in this? (It’s used through an iframe on the right of this page: Website)

PS: It’s supposed to get the topic name, author, date & time of the last 5 posts in my phpbb3 forum.

PPS: Here’s the iframe code

<!-- Recent posts -->
<div class="divx" style="position:absolute; top:170px; right:10px; width:200px; height:300px;">
<iframe height="300px" width="200px" scrolling="no" src="fetch.php">
</iframe>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T11:05:23+00:00Added an answer on June 7, 2026 at 11:05 am

    Managed to fix it:

    <?php
    // How Many Topics you want to display?
    $topicnumber = 5;
    // Scrolling towards up or down?
    $scroll = "up";
    // Change this to your phpBB path
    $urlPath = "/forum";
    
    // Database Configuration (Where your phpBB config.php file is located)
    include 'forum/config.php';
    
    $table_topics = $table_prefix. "topics";
    $table_forums = $table_prefix. "forums";
    $table_posts = $table_prefix. "posts";
    $table_users = $table_prefix. "users";
    $link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
    mysql_select_db("$dbname") or die("Could not select database");
    
    $query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id,
    p.post_id, p.poster_id, p.post_time, u.user_id, u.username
    FROM $table_topics as t, $table_forums as f, $table_posts as p, $table_users as u WHERE t.topic_id = p.topic_id AND f.forum_id = t.forum_id AND t.topic_status != 2 AND p.post_id = t.topic_last_post_id AND t.topic_last_poster_id = u.user_id ORDER BY p.post_id DESC LIMIT $topicnumber";
    $result = mysql_query($query) or die("Query failed");
    
    echo "";
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "";
    
    print "<a href=\"forum/viewtopic.php?f=" .$row["forum_id"] ."&t=" .$row["topic_id"] ."\"><font color=\"darkred\">" .$row["topic_title"] ."</font></a>       by: <a href=\"forum/memberlist.php?mode=viewprofile&u=" .$row["user_id"] ."\"><font color=\"darkred\">" .$row["username"] ."</font></a> 
    " .date('F j, Y, g:i a', $row["post_time"]) ."<br/><br/>";
    }
    
    mysql_free_result($result);
    mysql_close($link);
    ?>
    

    Added links & stuff aswell while I was at it :>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, this isn't for a keylogger, it's for an input in a
First of all there is probably a question like this already but i couldn't
First of all, apologize because I have seen some posts about this, but I
First of all, I got this huge xml file that represents data collected by
First of all, I am sorry if this question doesn't belong to SO since
first of all, I'd like to explain why i need this. i need to
first of all sorry for the title. I know this is not so clear
First of all, I just installed XE2 for the first time, and plan to
First of all, I know that this is because of bad libraries, but I
First of all (in case this is important) I'm using ActiveState's Perl (v5.8.7 built

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.