la solución
Código PHP:
Ver original<div id="test6" class="center-align light">
<?php
$consulta = $DB_con->query("SELECT * FROM hora_sorteo");
for ($set = array (); $row = $consulta->fetch(PDO
::FETCH_ASSOC); $set[] = $row); ?>
<table class='striped responsive-table centered'>
<thead>
<tr>
<?php for($i=0;$i<count($set);$i++){ echo "<th>" . $set[$i]['hora_sorteo'] . "</th>";
}?>
</tr>
</thead>
<?php
$consulta2 = $DB_con->query("SELECT
animalitos.id,
animalitos.numero,
resultado.id,
resultado.fk_animalitos,
resultado.fk_hora_sorteo,
resultado.fk_dias,
resultado.fecha,
hora_sorteo.id,
hora_sorteo.hora_sorteo,
dias.id,
dias.dias
FROM animalitos
INNER JOIN resultado ON animalitos.id=resultado.fk_animalitos
INNER JOIN hora_sorteo ON resultado.fk_hora_sorteo=hora_sorteo.id
INNER JOIN dias ON resultado.fk_dias=dias.id
WHERE resultado.fk_dias='6' ORDER BY resultado.id ");
for ($set2 = array (); $row = $consulta2->fetch(PDO
::FETCH_ASSOC); $set2[] = $row); ?>
<?php
foreach($set2 as $set){
echo "<tr>";
foreach($set as $v){
echo "<td>" . $v['numero'] . "</td>";
}
echo "</tr>";
}
?>
</table>
</div>