Newer
Older
ournorth2021 / api / ranking_desafio.php
LuisOlaya on 8 Apr 2021 1 KB primer
<?php        
	include("../app/models/connect.php");
?>

<div class="table-responsive">
<table class="table">
  <thead>
    <tr>
      <th scope="col">Pos.</th>
      <th scope="col">Participante</th>
      <th scope="col">Puntaje</th>
      <th scope="col">Equipo</th>
    </tr>
  </thead>
    <tbody>
        <?php
        $count = 1;
        $queryRanking = mysqli_query($connect,"SELECT SUM(puntaje), id_asistente FROM Desafio_Respuestas GROUP BY id_asistente ORDER BY SUM(puntaje) DESC ");
        while($dataRanking = mysqli_fetch_array($queryRanking)){
            
            $queryAsistente = mysqli_query($connect,"SELECT * FROM Asistentes WHERE id = '".$dataRanking["id_asistente"]."'  ");
            $dataAsistente = mysqli_fetch_array($queryAsistente); 
            
            echo '
            <tr>
              <td>'.$count.'</td>
              <td>'.$dataAsistente["nombre"].' '.$dataAsistente["apellidos"].'</td>
              <td>'.$dataRanking["SUM(puntaje)"].'</td>
              <td>'.$dataAsistente["equipo"].'</td>
            </tr>
            ';
            $count++;
        }
        ?>
        
        
    </tbody>
</table>
</div>