Page 1 of 1

[SOLVED] Alittle problem programming tagboard

Posted: Sat Jan 22, 2005 7:25 pm
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!

Posted: Sat Jan 22, 2005 7:36 pm
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 ;)

Posted: Sat Jan 22, 2005 7:41 pm
by hunterhp
Does each tag have a primary key? Like ID? if so, you could use ORDER BY on mysql_query

.

Posted: Sat Jan 22, 2005 7:45 pm
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.