Jump to content

Showing post from a phpbb forum elsewhere


legohead6

Recommended Posts

ok..on my homepage i want it to show the last 5 post from the phpbb forum(easy) the twist is i want it to be the last 5 posts from the announcements forum only(fourm_id=4) heres the code i have that displays the last 5 post...

[code]<html>
<body>

<?
$host = "localhost";
$user = "--";
$pass = "--";
$db = "phpforum";


$connection = mysql_connect($host,$user,$pass) or die ("Unable to
connect!");

mysql_select_db($db) or die ("Unable to select database!");

$query = "SELECT * FROM posts_text ORDER BY post_id DESC LIMIT 6";
$query2 = "SELECT * FROM post_subject ORDER BY post_id DESC LIMIT 6";
$result = mysql_query($query);
$result2 = mysql_query($query2);
$i=0;
$t=5;
if ($result && $result2) {
echo "Recent Forum Post<br><br>";
}
while($i < $t){
$first=mysql_result($result,$i,"post_text");
$sub=mysql_result($result,$i,"post_subject");

echo "Subject: <b>$sub</b><br>Message: <b>$first</b> <br><br>";
$i++;
}
?>
</body>[/code]

and here it is(with what i think is a good start toward my goal)

[code]<html>
<body>

<?
$host = "localhost";
$user = "--";
$pass = "--";
$db = "phpforum";


$connection = mysql_connect($host,$user,$pass) or die ("Unable to
connect!");

mysql_select_db($db) or die ("Unable to select database!");

$query = "SELECT * FROM posts_text ORDER BY post_id DESC LIMIT 6";
$query2 = "SELECT * FROM post_subject ORDER BY post_id DESC LIMIT 6";
$query3 = "SELECT forum_id FROM forums ORDER BY post_id DESC LIMIT 6";
$result = mysql_query($query);
$result2 = mysql_query($query2);
$result3 = mysql_query($query3);
$w=0;
$t=5;
$i= "forum_id";
if ($result && $result2 && $result3) {
echo "Recent Forum Post<br><br>";
}
while($w < $t){
$first=mysql_result($result,$w,"post_text");
$sub=mysql_result($result,$w,"post_subject");

echo "Subject: <b>$sub</b><br>Message: <b>$first</b> <br><br>";
$w++;
}
?>
<p>
</body>[/code]

please if possible dont give me aton of advanced stuff(because im trying to learn as i go..still quiet new to php)
Thanks
Matt
Link to comment
Share on other sites

[!--quoteo(post=361837:date=Apr 4 2006, 11:04 PM:name=cunoodle2)--][div class=\'quotetop\']QUOTE(cunoodle2 @ Apr 4 2006, 11:04 PM) [snapback]361837[/snapback][/div][div class=\'quotemain\'][!--quotec--]
In your query can't you just add this..

WHERE `fourm_id`='4'

Let me know
[/quote]

umm..this comes up for every one!

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in updates.php on line 26

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in updates.php on line 27
Subject:
Message:

lines 26 and 27 are here

$first=mysql_result($result,"post_text");
$sub=mysql_result($result2,"post_subject");
Link to comment
Share on other sites

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.