Hi Jule,
You need to sort your records with "ORDER BY" clause . I don't know what
your table looks like and obviously don't know if you have suitable columd
for it.. Say you have a newsid field defined with int datatype with
auto_increment property, then you can issue your statement as "SELECT ..
FROM table ORDER BY newsid DESC" to make the last inserted row at the very
top. Likewise, if you have a inserted date/time column to keep track of the
times that news are inserted , it may be used for the same purpose as well.


-----Original Message-----
From: Jule Slootbeek [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 6:39 PM
Subject: print on top

Hey guys and gals,
I'm writing this script for my new webpage, and i'm using MySQL to read and
add news articles to a page, but everytime i add a new article it puts it
under the older one, how can i get it on top?



$Link = mysql_connect ($Host, $User, $Password);
$Query = "SELECT * from $TableName";
$Result = mysql_db_query ($DBName, $Query, $Link);
while ($Array = mysql_fetch_array ($Result)) {
        print ("<table border=0 align=center valign=top width=100%>");
        print ("<tr align=center valign=top>\n");
        print ("<td align=left valign=top><b><i>$Array[header]</i></b></td>\n");
        print ("</tr>\n");
        print ("<tr align=center valign=top>\n");
        print ("<td align=left valign=top>$Array[article]</td>\n");
        print ("</tr>\n");
        print ("<tr align=center valign=top>\n");
        print ("<td align=right valign=top><font size=-2>Posted by: $Array[name] on
        print ("</tr>\n");
        print ("</table>");
Jule Slootbeek

Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to