Jump to content

Chat Script limit mysql display?


AbydosGater

Recommended Posts

Hi i have a basic chat script up and running, i got it done within an hour or so last night so its very basic at the moment.

But the section of my code that displays chat is..

[code]
$query = "SELECT * FROM chat_rc1 ORDER BY id DESC";
$result = mysql_query($query);
while($post = mysql_fetch_array($result)) {
$handle = $post['handle'];
$ip = $post['ip'];
$timestamp = $post['timestamp'];
$message = $post['message'];

echo "<i><b>$handle</b> @ $timestamp from $ip says:</i> <br> $message<br><br>";

}
echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"10; URL=recieve.php\">";

[/code]
So it displays the posts, and then every 10 seconds the page refreshs.

As you can see there it displays the posts from the newest to oldest in the DESC.
But what i was wondering how would i use LIMIT to limit it to only display the last say 25 posts?
how could i do this?

Thanks
Abydos
Link to comment
https://forums.phpfreaks.com/topic/25578-chat-script-limit-mysql-display/
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.