Jump to content

voting question.


corillo181

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.