• Welcome to Valhalla Legends Archive.
 

[PHP]Data Retrevial

Started by Forged, February 07, 2006, 12:19 AM

Previous topic - Next topic

Forged

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:
QuoteI wish my grass was Goth so it would cut itself

PaiD

I would say the Topic ID. Only accept the first title for each number.

rabbit

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.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

Forged

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.
QuoteI wish my grass was Goth so it would cut itself

Joe[x86]

if(!substr($SUBJECT), 0, 3) == "Re:")
{
  //nothing
}
else
{
  //topic
}
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

rabbit

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.'?
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

Joe[x86]

#6
Why would they do that? It'd break of course, but nobody ever changes it, so eh?
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

rabbit

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.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.