Jump to content

Recommended Posts

Hello,

 

I am planning on adding a voting system for videos on my website. Setting up the database. Which is better?

 

1. To have the votes included in the same table as the video information

 

Table videos
-------------------------
id (int)
name (varchar)
upvotes (int)
downvotes(int)

 

2. Have a separate table called 'votes'  in connection with the videos table that have the following colums, that looks like this.

Table votes
---------------
id (int)
video_id (int)
upvote (int)
downvote(int)

 

 

- If #2 is the best solution, would you use each vote to be one row in the database, or just to update the 'total vote count' for each corresponding video? i.e.

id/video_id/upvote/downvote
---------------------------------------
01/055/1333/100
(Example: 1333 votes up and 100 votes down)

 

 

Thanks so much for help /df

Link to comment
https://forums.phpfreaks.com/topic/208787-set-up-voting-system-for-videos/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.