471,337 Members | 906 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Rating

Hello every one
i had a question i am developing a site where i want users to be able to
rate products..but i want users to be able to only vote once per
product...i was wondering if any of you know could shed some light on
how i can accomplish this..i thought of using cookies but cookies can be
deleted...how can i keep track if a speicifc user has voted for a
specficed product or not

thank you

---
Best Regards
Amir

*** Sent via Developersdex http://www.developersdex.com ***
Jan 28 '06 #1
4 1495
Hi Amir,
probably the most affective way to do this is to require the user to
register and login before they can vote. Obviously if they really want they
can have multiple logins but it would be a deterant. Once the usre has voted
they are not allowed to vote again.

Mark.

"Amir Ghezelbash" wrote:
Hello every one
i had a question i am developing a site where i want users to be able to
rate products..but i want users to be able to only vote once per
product...i was wondering if any of you know could shed some light on
how i can accomplish this..i thought of using cookies but cookies can be
deleted...how can i keep track if a speicifc user has voted for a
specficed product or not

thank you

---
Best Regards
Amir

*** Sent via Developersdex http://www.developersdex.com ***

Jan 28 '06 #2

Hi Mark,
Thank you for your reply..users do have accounts...but my problem is how
to keep track of what user has voted for what product..i mean i dont
really want it to get into Sql sever..becuase it would just be a huge db
filler..you know all users ...all products..what products have
voted..what users have voted for that specific product...all too
overwhleming...is there an easy way of doing this?
---
Best Regards
Amir

*** Sent via Developersdex http://www.developersdex.com ***
Jan 28 '06 #3
Hi Amir
RE:
<< it would just be a huge db filler..you know all users ...all
products..what products have voted..what users have voted for that specific
product...all too overwhleming...i>>

It wouldn't have to be as huge as you say if you have a good data model for
this piece. You could have a simple junction table that logically sits
between your [users] and [products] tables. Only enter a row in this
junction table if the user voted. Absence of a row means absence of a vote.
So if the query "tell me if UserX has voted on ProductZ" returns zero rows,
then you know the user has not yet voted. The junction table could also
include additional properties of the vote, itself, like Date/Time of the
vote, or a product grade assigned (if they can assign some grade to a
product as part of their vote). This junction table could be relatively
small if all it has to do is store numeric IDs. Even tens of thousands of
rows would not amount to much space if it's just numerical and Date/Time
data.

-HTH


"Amir Ghezelbash" <am*******@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...

Hi Mark,
Thank you for your reply..users do have accounts...but my problem is how
to keep track of what user has voted for what product..i mean i dont
really want it to get into Sql sever..becuase it would just be a huge db
filler..you know all users ...all products..what products have
voted..what users have voted for that specific product...all too
overwhleming...is there an easy way of doing this?
---
Best Regards
Amir

*** Sent via Developersdex http://www.developersdex.com ***

Jan 28 '06 #4
Amir Ghezelbash wrote:
Hi Mark,
Thank you for your reply..users do have accounts...but my problem is how
to keep track of what user has voted for what product..i mean i dont
really want it to get into Sql sever..becuase it would just be a huge db
filler..you know all users ...all products..what products have
voted..what users have voted for that specific product...all too
overwhleming...is there an easy way of doing this?
---
Best Regards
Amir

*** Sent via Developersdex http://www.developersdex.com ***


There are only so many ways to do something like this:

-Cookies (not really effective like you said)
-Tracking by IP (quite bad too, lots of people can share the same IP on
some networks, ppl can use proxies to cheat the system still, ppl on
dialup with dynamic IPs, etc)
-And the old tracking with a database... A simple table like this should
work:

[ID] ID/pri key of ratings table (could do without if you wanted to...)
[UserID] FK to user's table
[ProductID] FK to products table
[Rating] the rating/vote itself

But yes, it can grow quite a lot (you could theorically have as many
rows in it than total_users*total_products; although that won't happen
it can get quite huge if site is big and popular), more burden on the DB
itself, more queries executed per page, more code, more sprocs, more
business logic/rules, more unit tests, more bugs to fix, etc. It's not
that huge or overwhelming, but I can see why you don't really feel like
it either, but it's the only real way to do this unfortunately.
Jan 29 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by jeremy | last post: by
2 posts views Thread by alex | last post: by
2 posts views Thread by Baron Samedi | last post: by
4 posts views Thread by bp90210 | last post: by
3 posts views Thread by cbtube03 | last post: by
pradeepjain
1 post views Thread by pradeepjain | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.