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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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