select and sort question
| From: | Kirk Babb | Date: | Sat, 27 Apr 2002 20:56:37 +0000 |
| Subject: | select and sort question | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-18852@lists.php.net to get a copy of this message | ||
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