Jump to content

Display newest mysql data?


EvanMartin

Recommended Posts

Im making a script to display the newest threads from my forum. I need to know how i can get the newest threads names in order.

Here's what i have so far.....

[quote]<?php
mysql_connect("********", "*******", "*******") or die(mysql_error());
mysql_select_db("******") or die(mysql_error());

$forum_post = mysql_query("SELECT * FROM forum_thread")
or die(mysql_error()); 

while($row = mysql_fetch_array( $forum_post )) {
$topic1 = $row['title'];
$topic2 = $row['title'];
$topic3 = $row['title'];
$topic4 = $row['title'];
$topic5 = $row['title'];
$topic6 = $row['title'];
$topic7 = $row['title'];
}

echo "<table border='1'>";
echo "<tr> <th colspan=\"2\">&nbsp;Recent Forum Threads</tr><tr>";
echo "<tr> <th><img src='http://homepages.xnet.co.nz/~jems.martin/images/arrow.gif'></th> <th>$topic1</th> </tr>";
echo "<tr> <th><img src='http://homepages.xnet.co.nz/~jems.martin/images/arrow.gif'></th> <th>$topic2</th> </tr>";
echo "<tr> <th><img src='http://homepages.xnet.co.nz/~jems.martin/images/arrow.gif'></th> <th>$topic3</th> </tr>";
echo "<tr> <th><img src='http://homepages.xnet.co.nz/~jems.martin/images/arrow.gif'></th> <th>$topic4</th> </tr>";
echo "<tr> <th><img src='http://homepages.xnet.co.nz/~jems.martin/images/arrow.gif'></th> <th>$topic5</th> </tr>";
echo "<tr> <th><img src='http://homepages.xnet.co.nz/~jems.martin/images/arrow.gif'></th> <th>$topic6</th> </tr>";
echo "<tr> <th><img src='http://homepages.xnet.co.nz/~jems.martin/images/arrow.gif'></th> <th>$topic7</th> </tr>";
echo "</table>";
echo "<P/\>";
?>[/quote]

That displays the newest thread fine but dosent display the the 2nd newest 3rd newest 4th newest ect
Any help will be greatly appreciated..

Thanks Evan!
Link to comment
https://forums.phpfreaks.com/topic/20351-display-newest-mysql-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.