Jump to content

SQL Pulling in order, how out of order? :P


AbydosGater

Recommended Posts

Hi, Sorry for the topic name!, bit confusing... But
Heres my script...

[code]
$query = "SELECT * FROM ben_news ORDER BY id";
$result = mysql_query($query);
while($news = mysql_fetch_array($result)) {
$member_id = $news['member_id'];
$author = "SELECT username FROM ben_users WHERE member_id='$member_id'";
$authorresult = mysql_query($author);
$authorinfo = mysql_fetch_array( $authorresult );
echo "<table width='455' border='0' cellspacing='0' cellpadding='0' background='image/longmenu.gif' height='34'>
        <tr>
          <td><FONT FACE='Tahoma'><b>" . $news['title'] . "</b></FONT></td>
        </tr>
      </table> ";
echo "<p>";
echo $news['content'];
echo "</p>";
echo "<p>";
echo "<hr><br>";
echo "Author: &nbsp; " . $authorinfo['username'] . "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; " . "Date/Time:&nbsp; " . $news['timedate'];
echo "</p>";
};

};

[/code]


Right no need to read all of that, but the Important bit is $query = "SELECT * FROM ben_news ORDER BY id";

The id field is an Auto Int.. And it all works fine! but i was wondering how do i get it to order backwards? start with the highest number, 5,4,3,2,1... and so on???

Thanks
Abydos
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.