0

I am making a website in which a user logs in and on the welcome page, he can add diiferent posts, like in facebook and those posts are shown on the same page using POST.

My question is that if i want to add comment boxes along with each post, what can be the code. Also please tell me how to manage the database when the comments will be added,, means what are the other tables that need to be created.

Right now I have 2 tables. one is the users table(attributes:user_id, username) and the other one is posts table(attributes: username, post_content)

Thanks in advance.

4

2 回答 2

0

好吧,您需要在每次用户发布某些内容时,提供该主题的 ID,即主帖。如果您使用ajax,那么您可以从您编写它的某个标签中读取它。但是,如果您使用$_POST,那么您可以使用type="hidden"来提供主题的 ex id。

于 2013-08-23T05:54:09.757 回答
0

如上所述,您可以管理评论框,就像使用发布内容框进行管理一样。对于数据库,我建议您在您的帖子表中添加一个类似“post_ID”的属性来唯一标识帖子。将此作为主键。

为评论添加另一个表,该表具有“commentID”(主要)“post_ID”等属性,它们指向他们所针对的帖子,“内容”用于评论内容,“User_ID”指向发布它的用户.

希望这可以帮助 !

于 2013-08-23T06:05:00.510 回答