vote only one time per link
hello,
I need your advice:
I am building a website that contains alot of links in a database.
the website shows the links and allow the users to vote for each link.
that means the links are set up in a table and each links has two icons:
one for "good" one for "bad" if the user clicks on the "good" it will count his vote and increment it by 1. and the same goes for the "bad" too (if the user click on the "bad" it wil increment his vote by 1)
and every link shows how many users voted "good" and how many voted "bad".
my question is this:
I only allow to registered users to vote, and I would like to allow them voting only once per link.
what is the best way of doing so?
I thouhjt of cookies but I dont think I can keep so much information on a cookie... no?
(I mean after all I have many links in my database and a cookie is limited in its size no?)
so I thought maybe use a table in the database to keep the voters for each link?
what do you think?
Yair
thanks for your answer...
you realy make a big effort here...
but unfortunately I cannot understand this code as it is too complicated for me to understand...
I wil however ask another question here:
I have this idea:
I belive that cookies is a bad way to do so because I can have unlimited links in my database.
therefor I think of creating another table with two columns:
USERNAME LINKNUMBER
everytime someone makes a vote I will put his username and the linknumber that hevoted for.
and before voting I will check if there is an existing record that contains the username and the link.
if there is a recordset like this then it means that this user already voted for the specific link.
if there is no record like this then it means the user didnt voted yet and I wil allow him to vote and add his usename and linknumber for the next time he will try to vote for the same link.
my question is this:
this kind of table might fill very fast and might contain many many records, suppose this table will contain milions of records will it make the vote proccess go slower?
Yair
thank you for that answer
I have been told twice today to make an index to the database.
can you tell me plese how can I make the index?
and how does it functioning?
Yair