Ver Mensaje Individual
  #12 (permalink)  
Antiguo 28/01/2012, 11:36
edwardrealmadrid88
 
Fecha de Ingreso: enero-2012
Ubicación: venezuela
Mensajes: 19
Antigüedad: 12 años, 3 meses
Puntos: 0
Pregunta Respuesta: sistema de Asistencias de un liceo

amigo estuve viendo el codigo y acomodandolo y asi lo acomode yo estoy es trabajando con:

MySQL
Servidor: localhost via TCP/IP
Versión del servidor: 5.1.30-community
Versión del protocolo: 10
Usuario: root@localhost
Juegos de caracteres de MySQL: UTF-8 Unicode (utf8)

Servidor web
Apache/2.2.21 (Win32) DAV/2 mod_ssl/2.2.21 OpenSSL/1.0.0e mod_autoindex_color PHP/5.2.8
Versión del cliente: 5.1.30
extensión PHP: mysql

phpMyAdmin
Acerca de esta versión: 3.1.1

la tabla de la base de datos es la siguiente:

Código MySQL:
Ver original
  1. -- phpMyAdmin SQL Dump
  2. -- version 3.1.1
  3. -- http://www.phpmyadmin.net
  4. --
  5. -- Servidor: localhost
  6. -- Tiempo de generación: 28-01-2012 a las 17:31:12
  7. -- Versión del servidor: 5.1.30
  8. -- Versión de PHP: 5.2.8
  9.  
  10. SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
  11.  
  12. --
  13. -- Base de datos: `asistencia`
  14. --
  15.  
  16. -- --------------------------------------------------------
  17.  
  18. --
  19. -- Estructura de tabla para la tabla `horarios`
  20. --
  21.  
  22. CREATE TABLE IF NOT EXISTS `horarios` (
  23.   `id` int(11) NOT NULL,
  24.   `de` time NOT NULL,
  25.   `le` time NOT NULL,
  26.   `me` time NOT NULL,
  27.   `mie` time NOT NULL,
  28.   `je` time NOT NULL,
  29.   `ve` time NOT NULL,
  30.   `se` time NOT NULL,
  31.   PRIMARY KEY (`id`)
  32. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  33.  
  34. --
  35. -- Volcar la base de datos para la tabla `horarios`
  36. --
  37.  
  38. INSERT INTO `horarios` (`id`, `de`, `le`, `me`, `mie`, `je`, `ve`, `se`) VALUES
  39. (1, '07:00:00', '08:00:00', '09:00:00', '10:00:00', '13:00:00', '15:00:00', '16:00:00');
  40.  
  41. -- --------------------------------------------------------
  42.  
  43. --
  44. -- Estructura de tabla para la tabla `registro`
  45. --
  46.  
  47. CREATE TABLE IF NOT EXISTS `registro` (
  48.   `id` int(11) NOT NULL,
  49.   `fecha` date NOT NULL,
  50.   `he` time NOT NULL,
  51.   `hs` time NOT NULL,
  52.   PRIMARY KEY (`id`)
  53. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  54.  
  55. --
  56. -- Volcar la base de datos para la tabla `registro`
  57. --
  58.  
  59. INSERT INTO `registro` (`id`, `fecha`, `he`, `hs`) VALUES
  60. (1, '2012-01-22', '07:00:00', '12:00:00');


y el la asistencia.php es la siguiente

Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Documento sin t&iacute;tulo</title>
  6. </head>
  7.  
  8. <body>
  9.  
  10. <?php
  11. //conexion con el servidor
  12. $conexion=mysql_connect("localhost","root","") or die("No Se Puede Conectar");
  13. //selecccion de la base de datos
  14. mysql_select_db("asistencia",$conexion) or die("No Hay Base de Datos Seleccionada.");
  15. //Consulto por las asistencias reales para el id $id
  16. $consulta="SELECT fecha,he,hs FROM registro WHERE id='1'";
  17. $resultadoR=mysql_query($consulta,$conexion);
  18. //Consulto por los horarios correspondientes para ese maestro (devuelve una sola fila de resultados)
  19. $consulta1="SELECT de,le,me,mie,je,ve,se FROM horarios WHERE id='1' ";
  20. $resultadoH=mysql_query($consulta1,$conexion);
  21. //Recupero ese resultado en una matriz numérica desde 0 hasta 6 (los 7 dias de la semana) llamada $horario
  22. $horario=mysql_fetch_row($resultadoH);
  23.          
  24.            
  25. ?>
  26. *
  27. <p>Asistencias de maestros</p>
  28. <table border="1">
  29. <tr>
  30.     <th>Fecha</th>
  31. * * <th>Entrada observada</th>
  32. * * <th>Entrada correspondida</th>
  33. * * <th>ESTADO</th>
  34. </tr>
  35.  
  36. <?php
  37.  
  38. while($fila=mysql_fetch_array($resultadoR)){
  39.  
  40. $fila["fecha"]=strtotime($fila["fecha"]);
  41. $dia=getdate($fila["fecha"]);
  42.  
  43. if ($horario[$dia['wday']] < $fila['he'])
  44.     {
  45.      $mensaje="TARDE";
  46.     }
  47.     else
  48.     {
  49.      $mensaje="Bien";
  50.     }
  51. ?>
  52. *
  53. <tr>
  54.   <th><?php $fila["fecha"] ?></th>
  55.   <th><?php $fila["he"] ?></th>
  56.   <th><?php $horario[$dia["wday"]] ?></th>
  57.   <th><?php $mensaje ?></th>
  58. </tr>
  59. </table>
  60.  
  61. <?php
  62. }
  63. ?>
  64.  
  65. *
  66.  
  67. </body>
  68. </html>

solo me muestra la tabla sin los valores aun estoy intentando pero nada de nada... alguna mano??? creo q es una tonteria lo q me hace falta