Jump to content

Integrating posts from IPB forum with website?


Duskybby

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. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.