Greetings !

I am trying to develop a website, much like, but a little simpler. The idea is:
- The visitor comes to my site and selects a category, then he is presented with various images which he can rate. He can rate the images without leaving the same page. Also, that same page would have a pagination too.

- The votes, ratings, image url, image id, would be stored in a database.

Do you think it is too hard to do? Can you give me some pointer or perhaps some code to look on? I already searched douzens of websites but they all have extensive code, like memberships and stuff, that I don't need.

If you can help me, please do.

Thanks in advance ! :D

Member Avatar

Depends how you want to do the DB update. Does this happen on rate star selection (for example) per image (so immediate in other words); or do you want to rate various images and then have an update button at the bottom?

If the former, use Ajax (all the rage now).

Pagination - again do you want to force a page reload on new page or do you want to do it via ajax (so it's 'in-page reload').

There are pros and cons to each method. The in-page method sounds great, but you need to pay attention to the browser BACK button problem.

I would suggest that you log an user's id in the 'ratings' table when rating an image to prevent them from rating it twice. To cut down on average calculations, you can have 'total_ratings' and 'number_ratings' fields in the 'images' table. This *I think* goes against normalization, but it should save a lot of calculations if you've got a lot of displayed images and thousands of ratings for each.


Sorry forgot, there are absolutely loads of ajax rating systems out there. jQuery have a few. You can adapt these to your own use.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.