Foro de elhacker.net

Programación => Bases de Datos => Mensaje iniciado por: Drakaris en 25 Febrero 2017, 19:59 pm



Título: Hola, me podrían ayudar?
Publicado por: Drakaris en 25 Febrero 2017, 19:59 pm
Hola estoy haciendo un calendario php mysql, ayudandome de un video.

https://www.youtube.com/watch?feature=player_embedded&v=T0y32_nEbys

hay un paso en que tienes que hacer "el contenido del calendario" los días en números.

Lo hice bien pero cuando lo subo a mi servidor el resultado no es el mismo.
la imagen esta en el enlace
https://drive.google.com/file/d/0B6mh5xJztGS9bHZrd0tJNDA5cTg/view?usp=sharing

Código:
<style>
    table.calendar{
        border: solid;
        border-color: #B45F04;
        background-color: #F7D358;
        font-family: segoe script;
    }
</style>
<html lang="es">
    <head>

    </head>
    <body>
    <?php
     if (isset($_GET['day'])) {
       $day = $_GET['day'];
      }else{
       $day = date("j");
      }

     if (isset($_GET['month'])) {
       $month = $_GET['month'];
      }else{
       $month = date("n");
      }

     if (isset($_GET['year'])) {
       $year = $_GET['year'];
      }else{
       $year = date("Y");
      }
    
     //calender variable
     $currentTimeStamp = strtotime("$year-$month-$day");
     $monthName = date("F", $currentTimeStamp);
     $numDays = date("t", $currentTimeStamp);
     $counter = 0;
    ?>
           <table border="1" class="calendar">
                   <tr>
                       <td><input width="50px" type="button" value="<" name="previousbutton" style="cursor: pointer;"></td>
                       <td colspan="5"><center><b><?php echo $monthName ."&nbsp;de&nbsp;".$year ?></b></center></td>
                       <td><input  width="50px" type="button" value=">" name="nextbutton" style="cursor: pointer;"></td>
                   </tr>
                   <tr>
                       <td width="50px"><center><b>Lunes</b></center></td>
                       <td width="50px"><center><b>Martes</b></center></td>
                       <td width="50px"><center><b>Mi&eacute;rcoles</b></center></td>
                       <td width="50px"><center><b>Jueves</b></center></td>
                       <td width="50px"><center><b>Viernes</b></center></td>
                       <td width="50px"><center><b>S&aacute;bado</b></center></td>
                       <td width="50px"><center><b>Domingo</b></center></td>
                   </tr>
                   <?php
                        echo "<tr>";

                        for ($i = 1; $i < $numDays+1; $i++, $counter++) {
                          $timeStamp = strtotime("$year-$month-$i");
                          if ($i == 1) {
                            $firstDay = date("w", $timeStamp);
                            for($j = 0; $j < $firstDay; $j++, $counter++) {
                             //black space
                             echo "<td>&nbsp;</td>";
                            }
                          }
                         if ($counter % 7 == 0) {
                           echo "<tr></tr>";
                           echo "<td align='center'>".$i."</td>";
                          }
                        }
                        echo "</tr>";
                   ?>
           </table>
    </body>
</html>

No sé lo que está mal lo revisé todo dos veces y no sé donde está el fallo.

Gracias.