title: How to access PHP table element with same name
body: <p>I have this SQL query</p>
  
  <pre><code>   $query="SELECT * FROM FLIGHTTABLE INNER JOIN AirplaneTable ON FLIGHTTABLE.AIRPLANEID = AirplaneTable.AIRPLANEID
      INNER JOIN AIRPORTTABLE from_airport ON FLIGHTTABLE.AIRPORTDEPARTURE = from_airport.AIRPORTID
      INNER JOIN AIRPORTTABLE to_airport ON FLIGHTTABLE.AIRPORTARRIVAL = to_airport.AIRPORTID
      INNER JOIN ROUTETABLE route ON FLIGHTTABLE.AIRPORTARRIVAL = route.TOAIRPORTID &amp;&amp; FLIGHTTABLE.AIRPORTDEPARTURE = route.FROMAIRPORTID
      WHERE $dateofdeparture_update $dateofarrival_update $airportofdeparture_update $airportofarrival_update $id_update$seats_update $status_update;";
  
      $res = mysql_query($query, GetMyConnection() );
      if (!mysql_num_rows($res))
      {
      if ($id)
  {
          $results = array('success' =&gt; false, 'error' =&gt; 'Este voo não foi encontrado');
          } else {
                 $results = array('success' =&gt; false, 'error' =&gt; 'Nenhum voo foi encontrado');
          }
            }
          else
          {
  
          while($row = mysql_fetch_array($res))
              {
                  //echo $row;
                  $data[] = array(
                          'id'   =&gt; $row['FLIGHTID'],
                          'status'   =&gt; $row['FLIGHTSTATUS'],
                          'reason'   =&gt; $row['REASON'],
                          'airplane' =&gt; array(
                              'id' =&gt; $row['AIRPLANEID'],
                              'name' =&gt; $row['NAME']
                          ),
                          'departure' =&gt; $row['DATEOFDEPARTURE'],
                          'arrival' =&gt; $row['DATEOFARRIVAL'],
                          'fromairport' =&gt; $row['AIRPORTDEPARTURE'],
                          'fromairportname' =&gt; $row['NAMEOFAIRPORT'],
                          'toairport' =&gt; $row['AIRPORTARRIVAL'],
                          'toairportname' =&gt; $row['NAMEOFAIRPORT'],
                          'price' =&gt; $row['PRICE'],
                          'availableseats' =&gt; $row['AVAILABLESEATS'],
                          'price' =&gt; $row['PRICE'],
                          'photo' =&gt; $row['PHOTO'],
                  );
              }
  
          $results = array('success' =&gt; true, 'data' =&gt; $data);
  </code></pre>
  
  <p>although <code>'fromairportname'</code> and <code>'toairportname'</code> should have different values they have the same value because <code>$row['NAMEOFAIRPORT']</code>,come out with the same value. How do I get the <code>$row['NAMEOFAIRPORT']</code> of the second inner join so that they show the actual departure and arrival datas?</p>
  
  <p>Thanks</p>