Need help with my script!
Posted: Sun Jun 14, 2009 4:31 am
Hi, I made a script that connects to my database and shows a list of people wo have recently posted in the forums.
I dont know why it wont show the details.... if anyone could help I would appreciate it very much
I removed the connection details for obvious reasons.
I dont know why it wont show the details.... if anyone could help I would appreciate it very much
I removed the connection details for obvious reasons.
Code: Select all
<?php
mysql_connect('***', '****', '******');
mysql_select_db("********");
echo("Recent Posts <p />");
$recent = mysql_query("SELECT * FROM phpbb_posts ORDER BY post_time DESC LIMIT 5");
while ($recent_row = mysql_fetch_assoc($recent))
{
// Get data
$post_id = $recent_row['post_id'];
$topic_id = $recent_row['topic_id'];
$forum_id = $recent_row['forum_id'];
$poster_id = $recent_row['poster_id'];
$post_time = $recent_row['post_time'];
// Get topic name
$topic_name = mysql_query("SELECT topic_title FROM phpbb_topics WHERE topic_id='$topic_id'");
$topic_name = mysql_fetch_assoc($topic_name);
$topic_name = $topic_name['topic_title'];
// Get username
$username = mysql_query("SELECT username FROM phpbb_users WHERE user_id='$poster_id'");
$username = mysql_fetch_assoc($username);
$username = $username['username'];
echo "$username posted in $topic_name";
}
?>