Jump to content

Comments on Individual Pages


epicpete

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.

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.