title: Is there a way to identify which data has been selected with the sql statement
body: <p>I have a sql statement:</p>
  
  <pre><code>$feed=$conn-&gt;prepare("SELECT * FROM posts WHERE post_by=? OR id=? ORDER BY id DESC LIMIT 10");
  $feed-&gt;bind_param("ii",$friend['id'],$like[id]);
  $feed-&gt;execute();
  </code></pre>
  
  <p>The <code>$friend['id']</code> is the id of a user's friend, <code>$like[id]</code> is the id of a like by the user's friend.</p>
  
  <p>The posts fetched with this query appear in a page.</p>
  
  <p><strong>What I want is I want to know which all posts have been posted by the user's friends (Which all posts have been fetched using <code>$friends['id'])</code> and which all posts have been liked by the user's friends and appear in the feed(Which all posts have been fetched using <code>$like['id']</code>)</strong></p>
  
  <p>I want to know all possibilities I can try to achieve what I want.</p>
  
  <p>I have tried varying my query with <code>UNION ALL</code> but it shows errors and I could'nt achieve what I want. </p>
  
  <p><strong>Currently there are no errors but I want the user to know how this post appeared in the newsfeed.</strong></p>
  
  <p>Hope you all get a good idea about my question and all types of hacks are also accepted as I want in someway to achieve the result I would also agree to change mt query nature.</p>
  
  <p>Please comment for more info.</p>
  
  <p>Thanks in advance.</p>