sfx81 Posted June 26, 2008 Share Posted June 26, 2008 Hi. Lookin at youtube, I cant figure out how they save user comments with videos. Could that just be an xml file which is associated with specific loaded page or ??? Any help will be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/112109-comments-on-page/ Share on other sites More sharing options...
LooieENG Posted June 26, 2008 Share Posted June 26, 2008 They probably use a database, and each comment has it's own row in a "comments" table, and one of the columns is "videoID", and when the video loads, it selects the comments where videoID = the ID of the video selected. I guess, anyway. Quote Link to comment https://forums.phpfreaks.com/topic/112109-comments-on-page/#findComment-575568 Share on other sites More sharing options...
sfx81 Posted June 27, 2008 Author Share Posted June 27, 2008 but in this way they have to keep a seperate table for each video, with comments and userid etc... Isnt there any performance issue with reading and writing to 100's and 1000's of tables at same time, and number of connection made to db etc... Quote Link to comment https://forums.phpfreaks.com/topic/112109-comments-on-page/#findComment-576375 Share on other sites More sharing options...
keeB Posted June 28, 2008 Share Posted June 28, 2008 No they don't. Read this: http://en.wikipedia.org/wiki/Relational_Database Quote Link to comment https://forums.phpfreaks.com/topic/112109-comments-on-page/#findComment-576414 Share on other sites More sharing options...
shlumph Posted June 29, 2008 Share Posted June 29, 2008 Looks something like this, obviously i left out fields, but you'll get the point. Video table: video_id | title | url | 32 Rick Rol.. q28af8 33 The cat.. 329af8 34 Born to .. 259d93 Comment Table: comment_id | video_id | comment 1 32 omgz epic! 2 32 yes omgz epic! 3 33 thats a fat cat Notice how the video_id in the comment table links to the video_id in the video table. Quote Link to comment https://forums.phpfreaks.com/topic/112109-comments-on-page/#findComment-577511 Share on other sites More sharing options...
dannyb785 Posted June 29, 2008 Share Posted June 29, 2008 youtube has insane servers. They're, at any second, playing millions of videos(and hosting many more than what are currently playing). But yea, they have a Video table and a Video_Comment table, with a video key that references the video it's commenting on. Not hard to design. Very simple actually Quote Link to comment https://forums.phpfreaks.com/topic/112109-comments-on-page/#findComment-577525 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.