I installed Invision Board on my website and I've been playing around with using the forum post news updates for my site. Instead of using a pre-made modification or hack, I want to try to write my own code.
Information regarding posts are basically stored in two tables: ibf_topics and ibf_posts. ibf_topics has the thread titles and ibf_posts has the content of the threads.
Right now, I have this:
$MaxPosts = 5;
$query = "select * from ibf_posts where forum_id=6 and new_topic = 1 order by post_date desc limit 0, $MaxPosts";
$result = mysql_query("$query") or
die (mysql_error());
while ( $row = mysql_fetch_array($result) )
{ ..... }
From the results, I also get the thread id which I can use to identify the corresponding thread title for the post. How should I go about getting information from both tables? Should I repeatedly query ibf_topics from inside the while loop? Can I query two tables at once and have MySQL return all the information in one array? Thanks.
Information regarding posts are basically stored in two tables: ibf_topics and ibf_posts. ibf_topics has the thread titles and ibf_posts has the content of the threads.
Right now, I have this:
$MaxPosts = 5;
$query = "select * from ibf_posts where forum_id=6 and new_topic = 1 order by post_date desc limit 0, $MaxPosts";
$result = mysql_query("$query") or
die (mysql_error());
while ( $row = mysql_fetch_array($result) )
{ ..... }
From the results, I also get the thread id which I can use to identify the corresponding thread title for the post. How should I go about getting information from both tables? Should I repeatedly query ibf_topics from inside the while loop? Can I query two tables at once and have MySQL return all the information in one array? Thanks.