How would I go about creating a 'like' system for entries? I'm creating a mini-blog system off of a guestbook format.
Basically I figure a star rating system for each post would be tricky. I just want something where a user would click a link under the post, it would store information in the database every time somebody clicked it, and then display the number of clicks back on the post. I'd also like to stop users from liking the post more than once if possible.
I am fairly new to this but I'm not just looking for code, I want to know how to do it myself.
Thanks.
Depending on what database engine you're using, you could use the MERGE statement, certainly works in SQL Server. It's basically an INSERT or DELETE depending on whether the data's already there or not, which would absolutely prevent duplicates without the need for doing a separate SELECT statement.
Okay great, thanks for all the help. How would I insert the record? What would I use to insert a record into the database when the link is clicked, and how would I display the number of clicks, or the number of records on the original post?
The blog will have many posts, so will I need to create a new table for every post? How would I get different results for each one?
North America
Europe, Middle East and Africa
Asia Pacific