thara Posted November 11, 2011 Share Posted November 11, 2011 Hi.. In my web site, users can download music videos. Now im going to add a top chart to my site. so need to add song to the chart according to their downloaded amount in a song and also it should be added only it's added date in last 10 days. I can create php script but have a problem in creating mysql query. Any help appreciated. Thank you.. Link to comment https://forums.phpfreaks.com/topic/250917-counting-most-downloaded-files-within-last-10-days/ Share on other sites More sharing options...
trq Posted November 11, 2011 Share Posted November 11, 2011 What have you tried? Link to comment https://forums.phpfreaks.com/topic/250917-counting-most-downloaded-files-within-last-10-days/#findComment-1287272 Share on other sites More sharing options...
thara Posted November 11, 2011 Author Share Posted November 11, 2011 SELECT song_id, song_title, side_bname, CONCAT_WS(' ', artist_fname, artist_mname, artist_lname) AS artist_name FROM songs INNER JOIN artists ON songs.artist_id = artists.artist_id WHERE songs.song_type = 'video' ORDER BY downloaded DESC Link to comment https://forums.phpfreaks.com/topic/250917-counting-most-downloaded-files-within-last-10-days/#findComment-1287277 Share on other sites More sharing options...
thara Posted November 11, 2011 Author Share Posted November 11, 2011 but its only display songs according to my downloaded system. so I need to select songs within a particular time period as well... any help appreciated. Link to comment https://forums.phpfreaks.com/topic/250917-counting-most-downloaded-files-within-last-10-days/#findComment-1287278 Share on other sites More sharing options...
fenway Posted November 11, 2011 Share Posted November 11, 2011 You need to add: songs.yourDateField > NOW() - INTERVAL 10 DAY To the WHERE clause. Link to comment https://forums.phpfreaks.com/topic/250917-counting-most-downloaded-files-within-last-10-days/#findComment-1287339 Share on other sites More sharing options...
thara Posted November 11, 2011 Author Share Posted November 11, 2011 thanks for your reply... as you said, I changed my query like this.... SELECT song_id, song_title, side_bname, downloaded, CONCAT_WS(' ', artist_fname, artist_mname, artist_lname) AS artist_name FROM songs INNER JOIN artists ON songs.artist_id = artists.artist_id WHERE songs.song_type = 'video' AND songs.added_date > NOW() - INTERVAL 10 DAY ORDER BY downloaded DESC LIMIT 10 but it doesn't work Link to comment https://forums.phpfreaks.com/topic/250917-counting-most-downloaded-files-within-last-10-days/#findComment-1287351 Share on other sites More sharing options...
fenway Posted November 13, 2011 Share Posted November 13, 2011 Doesn't work How? Link to comment https://forums.phpfreaks.com/topic/250917-counting-most-downloaded-files-within-last-10-days/#findComment-1287783 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.