Ganadores

<?php
$sql = "select * from premio where retiro=1 order by fecha_sorteo desc";
$query = mysql_query($sql);
?>
<table border="1">
<tbody>
<tr>
<td>Fecha</td>
<td>Descripcion</td>
<td>DNI</td>
<td>Participante</td>
</tr>
<?php
function participante($id) {
$sql2 = "select * from participante where dni=".$id;
$query2 = mysql_query($sql2);
$row2 = mysql_fetch_array($query2);
return $row2['nombre'];
}

while ($row = mysql_fetch_array($query)) {
?>
<tr>
<td><?php echo $row['fecha_sorteo']?></td>
<td><?php echo $row['detalle_premio']?></td>
<td><?php echo $row['id_participante_ganador']?></td>
<td><?php echo participante($row['id_participante_ganador'])?></td>
</tr>
<?php
}
?></tbody></table>