This topic is locked

Increasing a value (using AJAX?)

11/14/2013 3:34:16 PM
PHPRunner General questions
M
mrfdes author

Hi,

I use PHPRunner 6.2 Build 14199 on Windows 8.1 64bit.
I am trying to make a voting form for a Top-10 on my Internet Radiostation.
I have a MySQL table with 2 text fields: "Song" and "Artist" (for search purposes) and one INT field "Votes", for the count of the number of votes on every song.
What I want is for people to look for a song, and then (that is part of the problem, not sure HOW to let them do this) vote for that song.

When they submit the vote, the "Votes" field should be incremented by 1.
After voting, the list page should then show the songs, ordered by the number of votes (Only a total of 10 songs is required).
Someone also mentioned the use of AJAX to me, but, I'm afraid I do not have a clue on how to do this.
Can anyone help me out here, please?
Thank you in advance.

Sergey Kornilov admin 11/14/2013

Yes, this certainly can be done. Some programming skills will be required and it all depends on how smooth you need it to work.
The easiest option is to add a new field to Songs table and increase its value by one every time user access a designated voting page. Better option is to allow users to vote right from View or List page, in this case you need to use AJAX in order to update votes number behind the scene.
Besides that, you also need to prevent users from being able to vote more than once for any given song meaning you also need to store their IP address in a separate table and prohibit voting for any given song from the same IP addresses. It really gets more and more complicated if you start thinking of how you can build it right.

M
mrfdes author 11/14/2013

Thank you for your reply.
If I knew how to do the above, I certainly would.
Unfortunately, I do not have a clue how to achieve that.

Sergey Kornilov admin 11/14/2013

I guess you need to hire a programmer to do that. PHPRunner doesn't come with voting functionality. This is something that requires manual coding.