title: When getting data from two tables how can i make it so it doesnt duplicate the same result?
body: <p>I am attempting to get my head around retrieving data from multiple tables that share the same factor in this case it would be <code>something</code>. It's working fine however, whenever it displays the results it duplicates the same row from table <code>videos</code> for every comment that it displays, i know this is due to the fact that i have only uploaded 1 video and there is multiple comments but I'm otherwise unsure how to rectify it. Thanks in advance</p>
  
  <pre class="lang-php prettyprint-override"><code>$query = "select * from videos,comments where videos.something=comments.something ORDER BY comments.id,videos.id DESC"; 
  
  if ($result = $mysqli-&gt;query($query)) {
  
      while ($row = $result-&gt;fetch_assoc()) {
  
          $field1name = $row["id"];
          $field2name = $row["videoname"];
          $field3name = $row["username"];
          $field4name = $row["time"];
          $field5name = $row["description"];
          $field5name = $row["description"];
  
          $views = $row["views"];
          $uservideos = $row["user"];
          $comment = $row["comment"];
  
          echo '&lt;div class=videos&gt;&lt;p&gt;'.$field3name.' '.$field2name.'&lt;/p&gt;';
          echo '&lt;p&gt;'.$usa.' '.$comment.'&lt;/p&gt;&lt;/div&gt;';
  
      }
  
      $result-&gt;free();
  }
  </code></pre>