Note that there are some explanatory texts on larger screens.

plurals
  1. POSocial Network SQL statement for posts
    primarykey
    data
    text
    <p>I have been working on a Social Network to further my knowledge with PHP, however I have come to the point where I will be pulling posts from he database depending on who the user is "friends" with.</p> <p>My database structure for friends is as follows:</p> <pre><code>USER_A | USER_B | CREATED_AT | IS_BLOCKED </code></pre> <p>And then for the posts:</p> <pre><code>USER | UPDATE | STATUS </code></pre> <p>So, I want to show posts selected from my post table if the user logged in is friends with the user who posted it.</p> <p>So, basically, wondering if anyone has any suggestions. It won't be anymore complicated than that, not interested in getting friends of friends or anything like that. So, just wondering if someone could point me in the right direction with this one.</p> <p>I read it would require JOINs and such, however I have never really stepped into that side of SQL so therefore would have no idea what I would be doing with it, so links to relevant questions and articles on that, if required, would be appreciated.</p> <p>Thanks</p> <p>(I am essentially looking for help with the SQL statement, not with the PHP.)</p> <p><strong>Update #1:</strong></p> <p>I have got the newsfeed working, now I need to be able to join a statement to get the users names to be displayed. My current status is on this: <a href="http://sqlfiddle.com/#!2/b07793/1/0" rel="nofollow">http://sqlfiddle.com/#!2/b07793/1/0</a></p> <p><em>Before anyone goes crazy about storing passwords in plaintext, this is not a public system, it is purely for me to test, and hashing passwords for a non-public script that will only ever be used by me with fake passwords is hardly a security risk, it just makes debugging a pain.</em></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload