与我的网络PHP / SQL分享朋友的想法

时间:2014-01-13 15:16:09

标签: php sql

TABLE's:

members (id, fname, lname,...)
my_connections(id, member_id, connection_id, approved, ...)
my_thoughts(id, member_id, thought, shared, ...)

我根据my_connections提供了我的网络想法,如何与网络分享我的连接想法。

我需要传递与该想法相关的所有数据(包括它属于谁),以便它在我的网络Feed中显示为

John smith shared a thought from Jane smith

我尝试过: 我建立了一个连接表,即

shared_thoughts (id, member_id, thought_id, belongs_to_id, ...)

但我认为我的做法是错误的。

问题:如何与网络分享我的连接想法?

1 个答案:

答案 0 :(得分:1)

对我来说似乎是对的。在memberthought之间添加关系就足够了。

shared_thoughts (id, member_id, thought_id)

您已添加belongs_to_id,但这似乎没有必要(未规范化)。您可以通过thought_id找到它。