realcoder Posted June 27, 2010 Share Posted June 27, 2010 m just making a little script related to music portal infact want that when everybody click on songs play button separately i can count the click of every songs in daabase because want to fetch most played tracks so through this i can show eaily most played tracks www.hostrox.com/proj please help me that how i count clicks on play button of every song separetly... & give me more suggestions how to improve it more thanks Quote Link to comment https://forums.phpfreaks.com/topic/205977-want-to-count-hits-on-play-button/ Share on other sites More sharing options...
Psycho Posted June 27, 2010 Share Posted June 27, 2010 It seems all of your "Play" links go tot he same page and have an optional parameter to identify the track to be played. Here are two examples: http://www.hostrox.com/proj/songs.php?movie=Movii1# http://www.hostrox.com/proj/songs.php?movie=Film123# I assume this is all in a adatabase. So, one option would be to have a column in the songs table for "times_played" or somethign similar. Then, just add some code on the songs.php page to increment that value by one whenever the page is called. If the value of movie ont he query string is the unique ID for the record int he database, then the code might look something like this: $song_id = mysql_real_escape_string($_GET['movie']); $query = "UPDATE songs SET times_played = times_played + 1 WHERE song_id = $song_id"; $result = mysql_query($query); Quote Link to comment https://forums.phpfreaks.com/topic/205977-want-to-count-hits-on-play-button/#findComment-1077916 Share on other sites More sharing options...
realcoder Posted June 27, 2010 Author Share Posted June 27, 2010 so this will count by movie name how many times movie page come in used am i right...so mean becoz of my url i can't cou well i think when we click on play open a new windows with song tiltle & url from that i can count how many time a single song played if the same trick i use there in play.php what u say ?am i right na Quote Link to comment https://forums.phpfreaks.com/topic/205977-want-to-count-hits-on-play-button/#findComment-1077926 Share on other sites More sharing options...
realcoder Posted June 27, 2010 Author Share Posted June 27, 2010 thanks brother i done that after putting the code in play.php now i can count every songs played how many times thaks for idea Quote Link to comment https://forums.phpfreaks.com/topic/205977-want-to-count-hits-on-play-button/#findComment-1077944 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.