Jump to content
Larry Ullman's Book Forums

Recommended Posts

Re script 3 2 which I have customized to fit a webpage of mine on political cartoons...I replaced excellent with "funny" etc...so that is the project. What I would like is info on how to tally the votes I place on each cartoon and a sum of those votes. Just a general idea of what I should do next is O.K. because I am new at PHP. I know CSS and HTML, that's it. So, I would like to be pointed to info where I can learn to tally my votes and see that the tally corresponds to the votes I make. I have of course this book edition on my Kindle, and think it will give me the basics in which I am now beginning. Thanks..Nadeltanz

Link to post
Share on other sites

I suppose something as simple as adding an additional column to the DB for each cartoon for the number of "likes" would be sufficient.

Each time someone clicked the "Like" button, you could increment the counter in the DB for that cartoon by 1.

And when you're displaying the cartoons, you'd just pull the "likes" column from the DB as well.


The tricky part would probably be making sure that the "Like" button for an individual cartoon could only be clicked once per user.

Link to post
Share on other sites

HartleySan's suggestion will work fine. If you need to be more exacting, such as limiting each person to one like, you'd need to create a separate likes table with the cartoon id and the user id as the composite key. You could then use fancy SQL to count the likes.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...