将图像转换为评级系统[关闭]

Here's one that someone with some good web dev experience can really sink their teeth into:

I have a series of 4 images:
1. thumbs-up.jpeg
2. thumbs-up-unclicked.jpeg
3. thumbs-down.jpeg
4. thumbs-down-unclicked.jpeg

Here is the webpage that I have right now, of my four images, which change on mouseover: http://stateofdebate.com/test.html

What I'd like to do is be able to rate each debate topic (http://stateofdebate.com/debatelist.php), and also to rank arguments...to view arguments, sign up, enter a username and password, and login. Then you can click on any of the debates and see an argument.

There are several tasks that I don't know how to accomplish:
1. how to link the images with the mySQL database (do i turn them into some kind of object..?)
2. how to relate the thumbs up/down with each item (i.e. how to make a thumbs up/down ranking for each item)
3. how to get the debate topics to shift up and down based on which one has a better ratio of up/down

I know this may seem vague, but if you look at the links, it may clear things up.

Thanks!

Each user should have a record in a users table

users
id,...

Each image should have a record in an image table

images
id,created_date,file_path,...

Each vote should have a record in a junction table that looks like:

image_votes
user_id,image_id,vote_value

where the value is 0 for a down vote, 1 for an upvote, and no record exists for a nonexistent vote

further, for comments you would have a table that looks like

image_comments
id,image_id,user_id,text,created_date

then you could have a simliar voting system for comments

There's a good amount of work to be done here but I'll try to get you pointed in the right direction:

When you click an image, it needs to go to a php script that tells it if "up" or "down" has been clicked. Depending on what was clicked, it will increase a counter in the database for that post.

To connect to your database and query it: http://www.php.net/manual/en/mysqli.quickstart.php

When the page with the debate topics loads, it needs to look at the database for the likes and dislikes for each post and treat that as the score. For instance, you could do something like 10 likes and 3 dislikes would be a score of 7. You'd also tell the database query to sort by that score, so the list of posts you got back would be in order. There's a few different ways you could set up the upvoting and downvoting, just consider what data about the votes you want available. For example, does it matter to you for the DB to remember who voted for what?

As far as how to structure your database, it's a little more tricky but there are many resources available on how to set up your tables in a way that makes sense. Look up "Relational Databases" and "Normalizing."