title: how to suggest friends in php
body: <p>I want to suggest some friends randomly to users, no matter if there is any mutual friends between suggestion and current session_user.</p>
  
  <p>Here is what i have tried :</p>
  
  <pre><code>$sess = htmlspecialchars(mysqli_real_escape_string($con, $_SESSION['user_id']));
  
  $qet = mysqli_query($con, "SELECT user.id AS id, user.name AS name, user.u_name AS u_name, user.profile_pic AS profile_pic
  
  FROM user INNER JOIN user_friend ON (user.id = user_friend.add_by_id) OR (user.id = user_friend.add_to_id) 
  
  WHERE (user_friend.add_to_id != '$sess' or user_friend.add_by_id != '$sess') AND (user.id != '$sess') 
  
  ORDER BY RAND() LIMIT 1");
  </code></pre>
  
  <p>My table structure :</p>
  
  <p>user_friend</p>
  
  <blockquote>
    <ol>
    <li>id</li>
    <li>add_by_id</li>
    <li>add_to_id</li>
    <li>added_on</li>
    <li>accepted</li>
    </ol>
  </blockquote>
  
  <p>user</p>
  
  <blockquote>
    <ol>
    <li>id</li>
    <li>name</li>
    <li>u_name</li>
    <li>profile_pic</li>
    <li>email</li>
    <li>password</li>
    <li>gender</li>
    </ol>
  </blockquote>
  
  <p>I am not getting the proper results, it suggests me those friends also who are already friend with me(current session_user).</p>