Jump to content

Recommended Posts

Hey,

I'm currently working on a site whereby users can comment on images and videos in a youtube style way. At some point I'm going to implement a way for users to post videos and images but I haven't done this yet.

 

Videos are navigated to by video?id="videoid"

Images are navigated to by image?id="imageid"

 

I plan to make a comment section on each page, what i'm wondering is how sites of this type store comments.

 

I could give each video/image a new table but this could be hard to control considering at some point users will be able to submit there own resulting in new tables.

 

Is it possible to store comments in another way - like a comma separated list in the style:

user,comment,user,comment,

If so how would I do this using a 'for each'?

$a = split(',', $row['comments']);
		foreach ($a as $value) {
  		echo("$value");
  		}

 

the code above only grabs the comment. Is there a way I can make it give say $a the value of a user, then $b a value of comment?

 

If I could get this to work it would mean I could just have one table for the video/image with fields 'name','desc','videoid','comments' which would be ideal

 

I hope you see where i'm coming from :)

 

Thanks in Advance

 

Pete

Link to comment
https://forums.phpfreaks.com/topic/159753-comments-on-individual-pages/
Share on other sites

If I understand you right, you have a video table with the following fields:

name

desc

videoid

comments

And you want comments to contain a comma delimited list of user id and comments.

So, what if the user's comments contain commas? Having worked with csv situations, I always aim to avoid them when possible, so here's a suggestion...

 

Why don't you create one new table (that's all you need) with the following columns:

id, datetime, fk_video_id, user_id, comments

Then you can have multiple comments for each video, and you can timestamp em and it makes it easier to delete unwanted messages.

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.