Jump to content

Recommended Posts

I'm not sure the correct way to do this or to word this.

I need to be able to select everything posted from myself and from people that I'm subscribed to.

 

I tried JOINS, but I do not get the results I need, so I remember someone before showing me a different way, but all I keep getting are results for me, not from who i subscribe to as well.

 

Here is my code

<?php
$query2 = "SELECT * FROM users1 WHERE userid = '$user'";
                    $result2 = mysql_query($query2);
                    $p2 = mysql_fetch_assoc($result2);
					$follower = $p2['followers'];
					$me = $p2['userid'];

		//Grab all posts from user, and from their subscribers
		$query = "SELECT * FROM posts WHERE userid = '$follower'";
		$query = "SELECT * FROM posts WHERE userid = '$me' ORDER BY posted DESC";
                    $result = mysql_query($query);
                    while($p = mysql_fetch_assoc($result)){

					$posted = date("F j, Y g:i a", strtotime($p['posted']));
					$going = $p['going'];
					$city = $p['city'];
					$state = $p['state'];
					$p_user = $p['userid'];
					$p_folow = $p['followers'];
?>

 

Basically, I need to grab all posts from $me and from $follower.

 

Can anybody show me the correct way?

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/151997-solved-query-problem/
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.