corillo181 Posted August 13, 2007 Share Posted August 13, 2007 i'm making a website for msuic and i want people to vote for the songs that they link mos tand in the front page is going to show the song smos tpeople vote for.. wha ti want to know is how would you make this voting.. clear the vote ever week? or just keeps the votes as regular number .. how do they do it at other website like MTV , BET and all those website that you can go and vote for music. Quote Link to comment https://forums.phpfreaks.com/topic/64727-voting-question/ Share on other sites More sharing options...
akitchin Posted August 13, 2007 Share Posted August 13, 2007 i imagine the larger website retain every vote for a certain period of time, and deliver a dynamic average (ie. sum of all current vote values, divided by the total number of votes). when data size becomes an issue (which for you, probably won't), i imagine they backup the data to a static location like a text file and archive it. recording each vote uniquely allows you to use SUM() and COUNT() to calculate the average vote, as given above. Quote Link to comment https://forums.phpfreaks.com/topic/64727-voting-question/#findComment-322773 Share on other sites More sharing options...
corillo181 Posted August 13, 2007 Author Share Posted August 13, 2007 yeha i got a voting set up for the artist it did occur to me to use it for music voting but i was wondering if they reverse it or anything, but i guess i use the same code is not like people vote for the same music all the time they always got a new favorite.. thank you for your input. Quote Link to comment https://forums.phpfreaks.com/topic/64727-voting-question/#findComment-322776 Share on other sites More sharing options...
akitchin Posted August 13, 2007 Share Posted August 13, 2007 so do you mean to ask how you could achieve a "weekly" top ten? if so, this isn't so difficult - one simply has to add a WHERE clause to restrict the votes being counted to being this week. record the datetime that the vote is made, and in your WHERE clause you could stipulate: WHERE time_of_vote BETWEEN start_of_week_datetime AND end_of_week_datetime you'll need to manually calculate the start of week and end of week datetimes in order to enforce a truly "weekly" top ten. restricting it to 7 days before today (and newer) really only means the average vote you're delivering is more recent, rather than votes made only THIS week. decide how you want to treat the "week" (ie. Sunday-Saturday, for example) and we may be able to help you with calculating it. Quote Link to comment https://forums.phpfreaks.com/topic/64727-voting-question/#findComment-322778 Share on other sites More sharing options...
corillo181 Posted August 13, 2007 Author Share Posted August 13, 2007 Ok I think what would work for me is a code that calculates the votes between Saturday and Friday but would it be possible to make the list refresh only on Fridays? Like every other day the votes will just accumulate and then on Friday the list will refresh and show the new results... Quote Link to comment https://forums.phpfreaks.com/topic/64727-voting-question/#findComment-322784 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.