php, mySQL son x satırlar dönmek

0 Cevap php

I'm working on a php/mySQL/ajax shoutbox and have run into a small snag. On the page I want the content to be loaded from oldest to newest, with the newest on the bottom. I also want to limit the output to reduce load times once the database starts to get a lot of data in it.

Burada geçerli kod;

    <?php

include_once("../includes/db.php");
include_once("../includes/functions.php");

$q="SELECT tM.*, tC.char_name as username, tC.char_id as char_id
FROM shoutbox tM JOIN characters tC
ON tC.char_id=tM.char_id
ORDER BY shout_id DESC LIMIT 25";

db_Connect();

$result=mysql_query($q);

while($row=mysql_fetch_array($result))
{
    $classColor = getClassColor($row['char_id']);
    echo "<span class='".$classColor."'>".$row['username']."</span>: ",nl2br($row['shout_message'])."<br />";
}

mysql_Close();

?>

I while($row=array_reverse(mysql_fetch_array($result))) gibi $result = array_reverse(mysql_query($q)) kullanarak denedim ama ikisi de bir dizi beslenen ihtiyaçlarını array_reverse bir hata döndürür.

Şimdiye kadar ben SQL tarafında web üzerinde bulduk şey tüm "sadece buna göre DESC veya ASC kullanın." Cevap olmuştur

0 Cevap