Código PHP:
Ver original
<?php // I create the db connection //testing connection if (!$conn){ } //selecting a db mysql_select_db('calendar', $conn) or die('No se encontro la BD dando un error el cual es: '.mysql_error()); //Selecting the Query from patients_control //Hacemos el if/else para ver si se han seteado en la url mediante GET los parametros wk = semana //Si es lunes calculamos a partir de la fecha actual //verificamos si la variable $week no esta vacia //Si no esta vacia agregamos el valor de $week asignandole la marca de tiempo UNIX } else { //Si esta vacia simplemente le damos la marca de tiempo UNIX } } else { } else { } } //Array con los dias de la semana //Array Horas del dia $hours = array("6:00", "7:00", "8:00", "9:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Calendar Sample</title> <link rel="shortcut icon" href="icon" /> <link href="styles.css" rel="stylesheet" type="text/css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"> $(document).ready(function(){ var h = document.body.scrollHeight; var nh = Math.round(h/18); $('.tableheight').css({'height':h}); $('.trheight').css({'height':nh}); }); </script> </head> <body> <!-- Table: General --> <table class="tableheight" width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#ddd" > <tr> <th class="trheight"><a href="index.php?wk=<?php echo $week-1; ?>">Prev</a>-<a href="index.php?wk=<?php echo $week+1; ?>">Next</a></th> <?php //Bucle para mostrar los 7 dias de la semana for($i=0;$i<7;$i++){ //Sumamos días a la fecha del lunes actual //comprobamos si la fecha del bucle es la fecha actual //colocamos el dia actual en rojo y ponemos el array para mostrar los dias en español } else { //colocamos el el resto de los dias en gris y ponemos el array para mostrar los dias en español } } //hago los dias echo '<tr><th>'; echo $hours[$h]; echo '</th>'; for($y=0;$y<7;$y++){ //>>>>>>>>>>> AQUI CREO QUE DEBERIA IR EL WHILE PERO NO ME FUNCIONA, AYUDA PORFA } echo '</tr>'; } ?> </tr> </table> <!-- Table: General --> </body> </html>
Gracias