Right now im sorting by each articles auto_increment id with the query below
mysql_query("SELECT * FROM articles ORDER BY id DESC");
I wanna know how to sort by a date field i made, that stores the current date via, strtotime() it should query the dates from newest to oldest.
Current code
$alist = mysql_query("SELECT * FROM articles ORDER BY id DESC");
$results = mysql_num_rows($alist);
if ($results > 0){
while($info = mysql_fetch_array($alist)) {
// query stuff
echo $info['time'];
}
解决方案
Just change the column in the ORDER BY:
SELECT * FROM articles ORDER BY time DESC