[SOLVED] Alittle problem programming tagboard

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
TCStyle
Forum Newbie
Posts: 2
Joined: Sat Jan 22, 2005 7:15 pm

[SOLVED] Alittle problem programming tagboard

Post by TCStyle »

We'll I programmed alittle tag board for a friends site, not a big deal. But, I have run into alittle problem I do not know how to fix. Whenever the user inputs data it creates a new html table below the previous one, so now whenever anyone posts a message its all the way at the bottom of the screen ( check it out at http://tricitystyle.com/tagboard/post.htm ). How can I fix it so that the tables are create above the previous one? O, and here is my script that shows the html tables:

<?php
mysql_connect("noTelling", "noTelling") or die(mysql_error());
mysql_select_db("noTelling") or die(mysql_error());

$result = mysql_query("SELECT * FROM tagboard")
or die(mysql_error());

while($row = mysql_fetch_array( $result )) {
echo "<table border= '1' cellspacing= '0' cellpadding= '0'>";
echo "<tr><td bgcolor='#990000'>";
echo "<b><font color= '#FFFFFF'>".$row['name']."<font></b>";
echo "</td></tr>";
echo "<tr><td bgcolor='#FF0000'>";
echo $row['comment'];
echo "</td></tr>";
echo "<table>";
echo "<br />";
}

?>

I'm just at a stand-still here. Any help is greatly apperciated!
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

what is the primary key of those comments? is there a timestamp/date/datetime field?

just "SELECT * FROM foo ORDER BY datefield DESC"; would do ;)
hunterhp
Forum Commoner
Posts: 46
Joined: Sat Jan 22, 2005 5:20 pm
Contact:

Post by hunterhp »

Does each tag have a primary key? Like ID? if so, you could use ORDER BY on mysql_query
TCStyle
Forum Newbie
Posts: 2
Joined: Sat Jan 22, 2005 7:15 pm

.

Post by TCStyle »

timvw wrote:what is the primary key of those comments? is there a timestamp/date/datetime field?

just "SELECT * FROM foo ORDER BY datefield DESC"; would do ;)
Worked perfect, thank you very much.
Post Reply