Valhalla Legends Archive

Programming => Web Development => Topic started by: Forged on February 07, 2006, 12:19 AM

Title: [PHP]Data Retrevial
Post by: Forged on February 07, 2006, 12:19 AM
I am using the same forum this site uses for testing purposes on a portal I am making.  I am trying to display the threads from the news post,posted on my main page.  I have done that, but when I post the news threads it also post all the comments in the news threads as well.  After looking at the mysql tables I can't seem to see how the forum destinquishes between the two.  Any help on how to not post the comments would be appreciated.

my code:

$scan = mysql_query("SELECT * FROM `smf_messages` WHERE `ID_BOARD`= '2' ORDER BY `posterTime` DESC") or die(mysql_error());

while($row= mysql_fetch_array($scan)){
$user = $row['posterName'];
$time = $row['posterTime'];

$q = date("m/j/y h:i:s A", $time);

$s = mysql_query("SELECT * FROM `smf_members` WHERE `memberName` = '$user'") or die(mysql_error());
$r = mysql_fetch_array($s) or die(mysql_error());

$avy = $r['avatar'];

echo "<table cellpadding=0 cellspacing=0 width=400><tr><td width=100></td><td><b>". $row['subject'];
echo "</b><br /><img src=".$avy." align=left><i>". $row['body'] ."</i><br />";
echo "<font size=-2>".$q. "<br />".$user."</td></tr></table><br />";
}



the mysql table:
(http://www.securegamers.com/Forged/damnit.jpg)
Title: Re: [PHP]Data Retrevial
Post by: PaiD on February 07, 2006, 09:49 AM
I would say the Topic ID. Only accept the first title for each number.
Title: Re: [PHP]Data Retrevial
Post by: rabbit on February 07, 2006, 07:01 PM
Quote from: Savior on February 07, 2006, 09:49 AM
I would say the Topic ID. Only accept the first title for each number.
If ID_MSG == ID_TOPIC, it's the thread.  If ID_MSG != ID_TOPIC, ID_MSG is a reply to ID_TOPIC.
Title: Re: [PHP]Data Retrevial
Post by: Forged on February 07, 2006, 09:40 PM
No, Id_message is the post number, id_topic is the thread number.  So you could have message=100000 and thread=300 and it could still be a new thread.  However, I decided to use phpbb, seems like a better forum anyway.
Title: Re: [PHP]Data Retrevial
Post by: Joe[x86] on February 10, 2006, 04:43 PM
if(!substr($SUBJECT), 0, 3) == "Re:")
{
  //nothing
}
else
{
  //topic
}
Title: Re: [PHP]Data Retrevial
Post by: rabbit on February 10, 2006, 05:42 PM
Quote from: Joe on February 10, 2006, 04:43 PM
if(!substr($SUBJECT), 0, 3) == "Re:")
{
  //nothing
}
else
{
  //topic
}

What happens if someone changes the title to 'That's a stupid suggestion, Joe.'?
Title: Re: [PHP]Data Retrevial
Post by: Joe[x86] on February 11, 2006, 05:02 PM
Why would they do that? It'd break of course, but nobody ever changes it, so eh?
Title: That's a stupid suggestions, Joe.
Post by: rabbit on February 11, 2006, 05:07 PM
Quote from: Joe on February 11, 2006, 05:02 PM
Why would they do that? I'd break of course, but nobody ever changes it, so eh?
I'd like to see you even attempt to break anything.  And that is a gross generalization.  LOT's of people change the reply title.