Jump to content

Set up voting system for videos


defroster

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

Archived

This topic is now archived and is closed to further replies.

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