-
1. Re: 'Like' or Thumbs Up system.
Dan Bracuk Apr 18, 2012 5:11 AM (in response to Abidubbah)Create a user vote table with user id and post id as the primary key. That will prevent double entries. When the user selects the voting image, go to a page that inserts your record.
If you want to be thorough, you can also allow people to not like something.
-
2. Re: 'Like' or Thumbs Up system.
Owain North Apr 18, 2012 5:15 AM (in response to Dan Bracuk)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.
-
3. Re: 'Like' or Thumbs Up system.
Abidubbah Apr 18, 2012 6:34 AM (in response to Abidubbah)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?
-
4. Re: 'Like' or Thumbs Up system.
Dan Bracuk Apr 18, 2012 11:00 AM (in response to Abidubbah)I've heard good things about the books, "Database Design for Mere Mortals" and "Teach Yourself SQL in 10 Minutes". The nature of your questions suggests that you don't know very much about databases.
That's ok though. We are all new at least once.