How can I change this code to make these video appear with random videos so the videos are different when someone refreshes the page? This code is used on a forum block and works just fine but I want it to show random videos not the same ones every time.
Code:
global $vbulletin;
require_once(DIR.'/media/media_functions_hrefs.php');
// %d
$show_count = 5;
$medias = $vbulletin->db->query_read("
SELECT media.*, media_service.*
FROM " . TABLE_PREFIX . "media AS media
LEFT JOIN " . TABLE_PREFIX . "media_service AS media_service ON(media_service.serviceID = media.serviceID)
ORDER BY media.dateline DESC
LIMIT ".$show_count);
$output = '
<style type="text/css">
.thumbnail img{
width: 135px;
height: 90px;
border: 1px solid #ccc;
padding: 5px;
margin: 5px;
text-align: center;
float: center;
}
.video_bit {
text-align: center;
min-height: 120px;
}
</style>
';
while ($media = $vbulletin->db->fetch_array($medias))
{
$media['thumbnail'] = $vbulletin->options['media_thumb_dir']."/thumbs/". $media['mediaID'] .".jpg";
$media['href'] = construct_href_details($media);
extract($media);
$title = substr($title,0,60);
$mediabits .= sprintf('<div class="cms_widget_post_bit video_bit"><div class="thumbnail"><a href="%s"><img src="%s"></a></div><div class="cms_widget_post_header"><a href="%s">%s</a></div><div class="cms_widget_post_userinfo"><a href="member.php">%s</a> By %s</div></div>',$href,$thumbnail,$href,$title,$userid,$username,date('F j, Y, g:i a',$dateline));
}
$output .= $mediabits;