I need help with this function. currently it displays data from a sql server and it will display multiple items by date. I want to display the same data but by newest date first. Here is code for displaying the earliest date first.
public function displayMediaShortListReverse() {
global $LN;
if(!isset($this->media)) {
return false;
}
$html = "";
foreach($this->media as $mID => $m) {
$html .= '<tr>';
$html .= ' <td class="date" valign="top">'.$m['date'].'</td>';
$html .= ' <td class="bold" valign="top">';
if($m['status']=="Yes") {
$html .= '<a href="/media/?v='.$mID.'">'.htmlentities($m['title'],ENT_COMPAT,"UTF-8").'</a>';
} else {
$html .= htmlentities($m['title'],ENT_COMPAT,"UTF-8");
}
if($m['author'][0] or sizeof($m['author']) > 1) {
$html .= ' <span class="tblaudio-author tblaudio-top"><strong>'.$LN[26][LANGUAGE].'</strong>'; // Speaker
$values = "";
foreach($m['author'] as $author) {
$values .= $this->displayHTML($author).", ";
}
$values = trim($values,", ");
$html .= $values;
$html .= '</span>';
}
if($m['scripture']) {
$html .= ' <span class="tblaudio-author"><strong>'.$LN[28][LANGUAGE].'</strong>'.htmlentities($m['scripture'],ENT_COMPAT,"UTF-8").'</span>'; // Scripture
}
if(isset($m['group'])) {
$groupData = "";
foreach($m['group'] as $gID => $gTitle) {
$groupData .= $gTitle.", ";
}
$groupData = trim($groupData,", ");
$html .= '<span class="tblaudio-author"><strong>'.$LN[60][LANGUAGE].'</strong> '.$this->displayHTML($groupData); // Groups
$html .= '</span>';
unset($groupData);
}
$html .= ' </td>';
$html .= ' <td valign="top" class="tbl-audio-icons">';
if(isset($m['file'])) {
foreach($m['file'] as $file) {
if(strpos($file['location'],"http://")===false) {
$loc = FILES_URL.$file['location'];
} else {
$loc = $file['location'];
}
if($file['format']=="audio/x-mpeg" || $file['format']=="audio/mpeg") {
$html .= ' <a class="mp3" href="'.$loc.'">MP3</a>';
}
if($file['format']=="application/pdf") {
$html .= ' <a class="pdf" href="'.$loc.'">'.$LN[29][LANGUAGE].'</a>'; // Notes
}
}
}
if($m['connector'] and $m['connectorType']=="Vimeo") {
$html .= ' <a class="video2" href="/media/?v='.$mID.'" title="'.$LN[30][LANGUAGE].'">'.$LN[30][LANGUAGE].'</a>'; // Online Video
}
$html .= ' </td>';
$html .= ' </tr>';
}
return $html;
}
How do I work it to where it displays the most recent date first?