maxpup979 wrote:I believe you can use a user variable to accomplish this. Something like:
set @a:=0;
select @a:=@a+1 as rownum, songid, songname from songs where etc.
How would I go about putting that into a php script?
Part of my current script:
<?
// Select Latest Track Played
$select_latest = mysql_query("SELECT tracktime,starttime,datetime,title,album,artist,playcount,albumcover,filename FROM songs ORDER BY datetime DESC LIMIT 1");
$latest = mysql_fetch_array($select_latest);
// Function here that shows 'Played 5 mins ago', 'currently playing' etc.
// Show Track Info
SongStatus($trackunixdate,$time,"status");
SongStatus($trackunixdate,$time,"time");
echo("</u><br><b><font size='3'><a href='$filename'>$tracksong...</a></font>");
echo("<br>$trackartist ($trackalbum)<br>");
echo("<font size='1'><b>Duration:</b> $tracktime | <b>Play Count:</b> $playcount | <a href='javascript:MusicChart();'>Full Chart</a> | <a href='javascript:LastPlayed();'>Last Played</a></font>");
?>
This displays:
Now Playing: (or Played 5 min ago: etc.)
Beautiful Girls
Sean Kingston (No Album Entry)
Duration: 3:05 | Play Count: 109 | Full Chart | Last Played
What I want is:
Now Playing:
Beautiful Girls
Sean Kingston (No Album Entry)
Duration: 3:05 | Play Count: 109 (Number 3 in Charts) | Full Chart | Last Played
So say I had the following:
SongID Title Artist PlayCount
01 Beautiful Girls Sean Kingston 105
02 Chelsea Dagger The Fratellis 112
03 Alfie Lily Allen 96
04 Foundations Kate Nash 206
And it was Foundations that was playing (SongID: 4), I would like it to show that this is currently position 1 in the charts (as it's got the highest play count).
Similarly if Alfie (Lily Allen) were playing, I'd like it to show that it's currently at position 4 in the charts as it has the lowest play count. So out of 4 results, Lily Allen is result #4 and out of 4, Kate Nash is #1 and Fratellis #2 and Sean Kingston #3.
Thanks
Carl