Display query in reverse order? help help help help help

Basically I need to display everything I query from the DB in reverse Order, I tried using arsort but heck that didnt work. (It a small forum application and I want the new threads to be first )

HELP ME :-\

[php]

function AddField( $assoc, $column, $style )
{
echo ’

'. $assoc[$column] . “\n”;
}

[/php]

[php]<?php

//echo ‘’;

$connect = Connect_to_db(“forumVars.inc”);
$query = “SELECT Thread.*, date, author
FROM Thread, post
WHERE
parent_topic =” . $_GET[‘topicID’] . " AND
parent_thread = Thread.id AND
in_reply_to IS NULL";

$result = mysqli_query( $connect, $query );

if ($result == 0)
{
echo “Error: “;
echo mysqli_error($cxn).”
”;
}
else #28
{
echo "<table width=“100%”
class="forumline “cellpadding=“25"”;
echo " cellspacing=“1” border=“0” align=“center”>”;
echo “

”;
DisplayThreadsHeader();// heading for threads
for( $i = 0; $i < mysqli_num_rows( $result ); $i++ )

{
$thread = mysqli_fetch_assoc( $result );

echo “

\n”;
echo “”;
echo ‘’;
echo ‘’;
echo $thread[‘subject’];
echo “
”;
echo ‘
’;
echo " \n";
echo " ";
AddField( $thread, “replies”, “threadFiller” );
AddField( $thread, “author”, “threadFiller” );
AddField( $thread, “last_post”, “threadFiller” );
echo " ";
echo “\n”;

}

echo “

”;
echo ‘’;
echo “Ask A question
”;

}
?>[/php]

add
ORDER BY id DESC
to the end of your query

Your a genius!!! thnx

Sponsor our Newsletter | Privacy Policy | Terms of Service