PDA

View Full Version : how to avoid double display?


Lionel
01-25-2007, 07:14 PM
I am implementing a playlist system based on the downloads II hack. People click on an add or remove icon and song is added to playlist and play as a jukebox. It works fine, except that in songlist it displays double. Can someone please tell me how to correct the below query? I also tried to make it DISTINCT

$result = $db->query_read("SELECT dl.*, play.userid as userid FROM " . TABLE_PREFIX . "dl_files
as dl
LEFT JOIN " . TABLE_PREFIX . "playlist as play on (dl.url=play.fileurl)
WHERE `purgatory` = '0' AND `category` = ".$db->sql_prepare($cleancatid)." ORDER BY userid DESC, `pin` DESC,
`".$sortfield."` DESC LIMIT ".$db->sql_prepare($limit).",".$dl->perpage);
}
$uid=$vbulletin->userinfo['userid'];
if ($db->num_rows($result) > 0)
{
while ($file = $db->fetch_array($result))
{
$song=$file['url'];
$date = vbdate($vbulletin->options['dateformat'], $file['date'], true);
$downloads = vb_number_format($file['downloads']);
if ($file['userid'] == $uid){
$fimage="<a href=\"playlist.php?do=removesong&song=$song\"><img border=\"0\"
alt=\"remove from playlist\" src=\"/forums/images/misc/sound_delete.png\"></a>";
}else {
$fimage="<a href=\"playlist.php?do=addsong&song=$song\"><img border=\"0\" alt=\"add to
playlist\" src=\"/forums/images/misc/sound_add.png\"></a>";