title: Select Statement is loading the wrong data
body: <p>I'm having a problem with my SQL SELECT statement and I searched on Google and youtube but I found nothing.</p>
  
  <p>Here is my PHP code:</p>
  
  <pre><code>public function loadMark($data){
      dbConn(); 
  
      $query = "SELECT
          subject.subName
          , mark.mark
      FROM
          itcollage.marktype
          , itcollage.student
      INNER JOIN itcollage.parent 
          ON (student.pId = parent.pId)
      INNER JOIN itcollage.mark 
          ON (mark.stId = student.sId)
      INNER JOIN itcollage.subject 
          ON (mark.subId = subject.subId)
      WHERE 
          parent.pUsername='$data' 
      AND 
          mark.subId = subject.subId LIMIT 2";
  
      return $result=  mysql_query($query);
  
  }
  </code></pre>
  
  <p>and I wan't this to load the correct marks for the parents that got the students ID, but it keeps on repeating the marks for all subjects.</p>
  
  <p>Data as follows :</p>
  
  <pre><code>Subject      Mark
  --------  | ------
  Java 101  |   A
  Java 101  |   D
  Math 101  |   A
  Math 101  |   D
  </code></pre>
  
  <ul>
  <li>Java 101 = A, Math = D</li>
  </ul>
  
  <p>So whats wrong !!!</p>
  
  <p>And here is my code for calling the class marks.class.php </p>
  
  <pre><code>    include '../classes/mark.class.php';
  
      $mark = new mark();
      $result = $mark-&gt;loadMark($user);
      $num = mysql_num_rows($result);
  
       if ($num == 0) {
  ?&gt;
           &lt;h2&gt;No Marks for your Kid&lt;/h2&gt;
  &lt;?php
       } else {
  ?&gt;
           &lt;h2&gt;Marks&lt;/h2&gt;
           &lt;table&gt;
               &lt;thead&gt;
                   &lt;tr&gt;
                       &lt;th&gt;Subject&lt;/th&gt;
                       &lt;th&gt;Mark&lt;/th&gt; 
                    &lt;/tr&gt;
                &lt;/thead&gt;
                &lt;tbody&gt;
  &lt;?php
                    while ($row = mysql_fetch_object($result)) {
                        $marks = $row-&gt;mark;
                        $subject = $row-&gt;subName;
  ?&gt;
  
                        &lt;tr class="light"&gt;
                            &lt;td align="center"&gt;&lt;?php echo $subject; ?&gt;&lt;/td&gt;
                            &lt;td align="center"&gt;&lt;?php echo $marks; ?&gt;&lt;/td&gt;
                        &lt;/tr&gt;
  
   &lt;?php
                     }
   ?&gt;
                 &lt;/tbody&gt;   
             &lt;/table&gt;
  </code></pre>
  
  <p>Can anyone show me what's wrong?</p>