+ 2
Help with making a rating system for my images on my website.
I have a sript that takes my images out of a folder and loads them onto my website. I would like to make a custom rating sytem for each one of my images and i want to store the results in a mysql database. i then want to take the info from the database and display it with each image as well. not sure where to start. any help would be great. thanks in advance.
3 ответов
+ 1
the best way is to plan it in steps (using english words) and then expand on each step if necessary, and once you're done, start implementing each step alone. for example:
1. load and display images on the website
2. show a rating bar for each image
3. handle user click on an image rating
4. persist the user action to the database
this probably handles everything related to getting ratings. you could do something similar for generating reports.
and just an addon hint, you could also expand on step 3 to identify users to prevent a single user from rating an image more than once. but that depends on your requirements.
hope this helps..
+ 1
you can start by creation a mysql table containing rows (id, imagefilename, votes)
in order to record the votes you need a php function where you add 1 to the votes row when is click vote up and subtract 1 when clicked vote down .
and you will have the votes value to display with every image .
+ 1
Thanks for the great answers.
I have started this project and you can see where i am at by clicking the link
http://metrikcorp.com/test/rate/index.php