Jump to content

Recommended Posts

I wanted to do something like the code below

$str = "SELECT news_feed.*, friends.*, articles.*
FROM 
news_feed
  INNER JOIN articles
   ON news_feed.name = anime.name  OR inner join friends on news_feed.name = friends.friendname
WHERE friends.username = '$name' or articles.subscriptor = '$name'";

 

what its supposed to do is check the tables "articles" and "friends" and check if they are related to the $name (i.e. $name is a friend of $friendname or $name is subscribed to this article) and then get the items from news_feed that $name's friends and the articles he is subscribed to posted

Link to comment
https://forums.phpfreaks.com/topic/235668-inner-join/
Share on other sites

what I want to do is something like... i want to get rows from the news_feed that my friends and articles i subscribed to posted... but the only way to determine if i am friends with the one who posted or if i am subscribed to that article is checking 2 different tables.... so its sorts like "news_feed INNER JOIN ON friends OR articles" and not joining 3 tables

Link to comment
https://forums.phpfreaks.com/topic/235668-inner-join/#findComment-1211447
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.