我正在尝试更改此查询以正确按日期排序。
此行有效,但并未正确排序所有日期。它按年而不是按日和月排序。
$query = mysql_query
("SELECT `date` FROM `table` WHERE `day` LIKE '%$row->period$row->friday%' AND date != '' ORDER BY `date` DESC LIMIT 1");
while($row2 = mysql_fetch_object($query)){
echo $row->date;
我创建了这个,但回声保持为空。我做错了什么?
$query = mysql_query
("SELECT DATE_FORMAT(date, '%d-%m-%Y') as `date2` FROM `table` WHERE `day` LIKE '%$row->period$row->friday%' AND date != '' ORDER BY `date` ASC LIMIT 1");
while($row = mysql_fetch_object($query)){
echo $row->date2;