Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display top 20 records using id as DESC 1

Status
Not open for further replies.

dwlerwill

Technical User
May 25, 2001
329
hi all

trying to make an online php chat system and I would like to display the last 20 records I have the following

$chattext="SELECT user, chat_line FROM gamechat ORDER BY id DESC LIMIT 20 ";
$chattext2=mysql_query($chattext) or die("Could not get user stats");
$chattext3=mysql_fetch_array($chattext2);

i'm having problems displaying the results all I want is a simple 20 line display of the results but I can not get it to work with print any ideas?

David Lerwill
"If at first you don't succeed go to the pub"
 
Code:
echo "<dl>";
while ($row = mysql_fetch_assoc($chattext2)):
 echo "<dt>$row['user']</dt><dd>$row['chat_line']</dd>";
endwhile;
echo "</dl>";
 
Thank you :)

David Lerwill
&quot;If at first you don't succeed go to the pub&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top