title: SQL command doesn't invoke the specific query
body: <p>I have 2 tables one is with replies and second with added friends. Both tables have fields of ids of the friend ( receiver ) and the reply poster. I inner join these tables on receiver_id and added_friend where username in 'friends' is $_SESSION['user'] ( the logged person ). All I receive after the query are just replies ( both parties see them ) and cannot query the reply back ( both parties cannot see the other's replies ) why is that so ? The code seems to be logical...Thanks a lot.</p>
  
  <pre><code>   CREATE TABLE IF NOT EXISTS `friends` (
    `id` int(11) NOT NULL auto_increment,
    `username` varchar(128) character set utf8 NOT NULL,
    `added_friend` varchar(128) character set utf8 NOT NULL,
    `friendname` varchar(128) character set utf8 NOT NULL,
    PRIMARY KEY  (`id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;
  
     --
  
    CREATE TABLE IF NOT EXISTS `reply` (
    `rep_id` int(11) NOT NULL auto_increment,
    `reply_comm` text character set utf8 NOT NULL,
    `reply_poster` varchar(128) character set utf8 NOT NULL,
    `reply_poster_id` int(11) NOT NULL,
    `receiver_name` varchar(128) character set utf8 NOT NULL,
    `receiver_id` int(11) NOT NULL,
    `reply_date` date default NULL,
    PRIMARY KEY  (`rep_id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;    
  </code></pre>
  
  <p>The structure looks like that:</p>
  
  <p>Table 'friends' :</p>
  
  <pre><code>          username | added_friend
            =====================
            mike     | 10
            rob      | 20
  </code></pre>
  
  <p>Table 'reply' :</p>
  
  <pre><code>          reply_poster | receiver_id
            =========================
            mike     | 20
            rob      | 10  &lt;- added friend id
  </code></pre>
  
  <p>The PHP SQL command is this:</p>
  
  <pre><code>        $repcheck2 = mysqli_query($connect,"SELECT * FROM reply INNER JOIN friends ON  
          receiver_id  = added_friend  WHERE username = '".$_SESSION['user']."' ORDER BY rep_id  
          DESC ");
  </code></pre>
  
  <p>So both parties should see replies and posts when logged in ( $_SESSION['user']) but cannot see the replies back only their own posting replies / comments. Thanks a lot...</p>