Skip to content

Instantly share code, notes, and snippets.

@devloe
Forked from anonymous/index.php
Created September 22, 2012 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devloe/3768068 to your computer and use it in GitHub Desktop.
Save devloe/3768068 to your computer and use it in GitHub Desktop.
<div id="main">
<?php foreach($programacion->dias as $i => $nombre){ ?>
<div class="todos">
<?=$nombre?>
<table class="listado">
<?php
$listado = $programacion->listar($i);
while($row = mysql_fetch_assoc($listado)){
?>
<tr>
<td>Nombre <br /><?=$row['nombre']?></td>
<td>Horario<br /><?=$row['horario']?></td>
<td>Integrantes<br /><?=$row['integrantes']?></td>
<td>Dia<br /><?=$row['dia']?></td>
</tr>
<?php } ?>
</table>
</div>
<?php } ?>
var $dias = array(
1 => 'Lunes',
2 => 'Martes',
3 => 'Miércoles',
4 => 'Jueves',
5 => 'Viernes',
6 => 'Sabado',
7 => 'Domingo'
);
function listar($dia = null){
$sql = "select * from programacion ";
if($dia){
$sql .= "where dia = $dia ";
}
$sql .= "order by horario";
$query = mysql_query($sql, $this->db);
if(!$query){
$this->debug = mysql_error();
}
//var_dump($dia);
return $query;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment