title: Json response giving me different output
body: <p>I am getting the same value for the 1st, 2nd and 3rd rows in my json response. The supposed result for the 2nd row displays in the second column and the 3rd result supposed in the 1st column displays in the 3rd.</p>
  
  <pre><code> $sql = "select
            e_name,
            a_shortcut,
            case
              when t_rank = 1 then '1st'
              when t_rank = 2 then '2nd'
              when t_rank = 3 then '3rd'
            end as t_rank
          from
            team inner join event on team.EID = event.eid Where e_type = 'nonsport' group by event.eid";                         
  
           $con = mysqli_connect($server_name,$mysql_user,$mysql_pass,$db_name); 
  
          $result = mysqli_query($con,$sql);
  
  
           $response = array();
  
          while($row=mysqli_fetch_array($result))
          {
          array_push($response, array("e_name"=&gt;$row[0],"1st"=&gt;$row[1], 
          "2nd"=&gt;$row[2], "3rd"=&gt;$row[2]));
  
          } 
          echo json_encode (array("nresults"=&gt;$response));
  </code></pre>
  
  <p>Here is what im getting in my server response if my 2nd and 3rd rows are [2] and [2].</p>
  
  <pre><code> {"nresults":[{"e_name":"Amateur Photography Contest","1st":"AAA","2nd":"3rd","3rd":"3rd"}]}
  </code></pre>
  
  <p>If i changed </p>
  
  <pre><code>1st"=&gt;$row[1], 
          "2nd"=&gt;$row[2], "3rd"=&gt;$row[2] into 1st"=&gt;$row[1], 
          "2nd"=&gt;$row[1], "3rd"=&gt;$row[1]
  </code></pre>
  
  <p>It becomes like this</p>
  
  <pre><code>{"nresults":[{"e_name":"Amateur Photography Contest","1st":"AAA","2nd":"AAA","3rd":"AAA"}]}
  </code></pre>
  
  <p>My expected output is:</p>
  
  <pre><code>{"nresults":[{"e_name":"Amateur Photography Contest","1st":"AAA","2nd":"BBB","3rd":"CCC"}]}
  </code></pre>
  
  <p>where "AAA" is rank 1, "BBB" is 2 and "CCC" is 3.</p>
  
  <p>Can someone help me please?</p>