Why don't you sort in your SELECT statement? SELECT * FROM newsitems where ID='1' ORDER BY newsdate DESC
----- Original Message ----- From: Kirk Babb <[EMAIL PROTECTED]> To: <> Sent: Saturday, April 27, 2002 3:56 PM Subject: [PHP-DB] select and sort question I have a db table which holds news in the following manner: ID (auto-increment), newsdate (DATE), newstitle, and newstext I have been displaying them by ID, and would like instead to sort them by date (descending). Since I'm using Flash I have been doing mysql_fetch_array for each ID query and then separating the fields out for placement in the dynamic text fields (has to be done for formatting), like so: $news_details1 = mysql_query("SELECT * FROM newsitems where ID='1'"); $headlines1 = mysql_fetch_array($news_details1); ....then populate the fields with echo "&newstitle1=" . $headlines1["newstitle"] etc. Can I do this in a better way (more efficient)? and sort by date? I haven't done any sorting before, and if it pulls all the data into an array wouldn't that really be a 2D array? How do I handle that? Thanks for any help or suggestions, Kirk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php