Hi, I'm building a site where users can connect with each other. I'm trying to let users post comments like one would on Twitter or Facebook. Currently, I have it so the user has to update there comments but I would rather them post new ones. Basically, how is this done. Any keywords would be helpful, I'm just not sure where to start. Thanks!

Recommended Answers

All 4 Replies

Use an INSERT query instead of an UPDATE query.

like one would on Twitter or Facebook

different concepts different specs and even inside them are different logic in each service. First of all you must write down what you are doing in words first if you can’t directly in UML. Then you must set a plan of how to do it, and architecture to achieve it.

Member Avatar for diafol

You need to post your DB structure. You have a choice of whether to make every post a new post (Twitter) or whether to use 'threads' (Facebook), where a first post on a new topic is the 'parent' and replies to that post are its children. Both systems are easy to implement.

You could have something like:

post_id | poster_id | title | body | timestamp | status | parent_id

So, if the parent id is not 0, the post has to be a child of that parent. If 0, the post is a parent. Anyway, quite a few ways you could go with this.

commented: Good detailed answers +2

Thanks for responses. I have to think about structure more but answers helpful. I'm going to mark as solved for now but would like to ask more about this in future.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.