Jump to content

Recommended Posts

I'm trying to integrate my website with my Invision Power Board forum. I'm trying to have the posts from the news & updates section to be placed also on the home page automatically. This is the design for that portion of my homepage (sorry if the text offends you). I was able to make the posts display, but I can't figure out how to make it only display from a specific forum. I only want the first post of each topic from the News and Updates section of my forum to display here, but it's currently displaying them all.

 

This is what I have for the page so far.

 

<?php

include ("includes/global.php");
mysql_select_db("kingdom");

$news = mysql_query("SELECT * FROM ipb_topics ORDER BY start_date DESC");
while ($news_row = mysql_fetch_assoc($news))
{
//get data
$topic_id = $news_row['tid'];
$forum_id = $news_row['forum_id'];
$starter_id = $news_row['starter_id'];

//get topic name
$topic_name = mysql_query("SELECT title FROM ipb_topics WHERE tid='$topic_id'");
$topic_name = mysql_fetch_assoc($topic_name);
$topic_name = $topic_name['title'];

//get user name
$username = mysql_query("SELECT name FROM ipb_members WHERE member_id=$starter_id");
$username = mysql_fetch_assoc($username);
$username = $username['name'];

//get post info
$post = mysql_query("SELECT post FROM ipb_posts WHERE topic_id=$topic_id");
$post = mysql_fetch_assoc($post);
$post = $post['post'];

echo "<h1>$topic_name</h1> $post<br /><br /> posted by $username<br /><br />";

}


?>[code]

Any help will do. Please. 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.