Question by rowan.ashe: I’m building a php news section – how do you categorise date with the same date (please read details)?
In my news section I list 25 most recent news articles from a mysql database. Each article is listed with the most recent at the top descending down the list. Each one starts with the date with a line beneath that and the news title as a url below that. What I’m trying to find out is if two or more articles have the same date, how do I get it to appear under the same date. Should I use an array of some kind?
Answer by Web Design Midlands
You could issue an sql statement and order by ‘columnname’ asc
eg (replace column_name with you date column name)
$ mysqlvariable =”SELECT “column_name”
ORDER BY “column_name” [ASC, DESC]“;
$ result = mysql_query($ mysqlvariable);
echo (mysql_fetch_array($ result));
Haven’t checked if it works but something along these line
Web Design Midlands
Give your answer to this question below!
There are no revisions for this post.