Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/05/2008, 10:14
Avatar de Carlojas
Carlojas
 
Fecha de Ingreso: junio-2007
Ubicación: Shikasta
Mensajes: 1.272
Antigüedad: 16 años, 11 meses
Puntos: 49
Respuesta: No se muestran los resulatdos de la consulta en el navegador

Que tal efelix, verifica que tu consulta no tenga errores.

Código PHP:
<?php
/*$buscar = trim($buscar);
if (!$buscar)
   {
      echo "Error: Usted no ha introducido ningún criterio de búsqueda.";
      exit();
   }
 */  
$link =  mysql_pconnect("localhost""efelix""mychildren");
if (!
$link)
   {
     echo 
"Error: No es posible conectarse a la base de datos en estos momentos.
           Por favor inténtelo más tarde."
;
    exit();       
   }
$db =  mysql_select_db("plan_si");
if (!
$db)
   {
     echo 
"Error: No se encuentra disponible la tabla a la que intenta conectarse.
           Por favor inténtelo más tarde"
;
    exit();       
   }
$query "SELECT grupos.nombregrupo, 
trabajadores.nombreworker, servicio.nombreserv, 
CASE MONTH(tabla_union.FechaProduccion) = 1 THEN \"Enero\" 
WHEN MONTH(tabla_union.FechaProduccion) = 2 THEN \"Febrero\" 
WHEN MONTH(tabla_union.FechaProduccion) = 3 THEN \"Marzo\" 
WHEN MONTH(tabla_union.FechaProduccion) = 4 THEN \"Abril\" 
WHEN MONTH(tabla_union.FechaProduccion) = 5 THEN \"Mayo\" 
WHEN MONTH(tabla_union.FechaProduccion) = 6 THEN \"Junio\" 
WHEN MONTH(tabla_union.FechaProduccion) = 7 THEN \"Julio\" 
WHEN MONTH(tabla_union.FechaProduccion) = 8 THEN \"Agosto\" 
WHEN MONTH(tabla_union.FechaProduccion) = 9 THEN \"Septiembre\" 
WHEN MONTH(tabla_union.FechaProduccion) = 10 THEN \"Octubre\" 
WHEN MONTH(tabla_union.FechaProduccion) = 11 THEN \"Noviembre\" 
WHEN MONTH(tabla_union.FechaProduccion) = 12 THEN \"Diciembre\" 
ELSE \"Esto no es un mes\" END AS Mes, tabla_union.PLAN, 
tabla_union.PROD FROM (grupos INNER JOIN trabajadores 
on grupos.IDGRUPO = trabajadores.IDGRUPO) INNER JOIN (servicio INNER JOIN 
tabla_union ON servicio.IDSERVICIO = tabla_union.IDSERVICIO) ON trabajadores.IDWORKERS = 
tabla_union.IDWORKERS"
;
          
$resultado =  mysql_query($query$link) or die("Error en query $query:" .mysql_error() );
if (!
$resultado)
  {
    echo 
"Error: Los elementos de la tabla no están disponibles en estos momentos.
          Por favor inténtelo más tarde"
;
   exit();          
  }
 
$registros =  mysql_num_rows($resultado);
if (
$registros 0)
  {
    echo 
"Lo sentimos, no se ha encontrado ninguna coincidencia con '$buscar' en nuestra Web.";
  }
             
$encabezamiento=<<<EOD
<h2><center>Cumplimiento del Plan</center></h2>
<table width="70%" border="1" cellpadding="2"
cellspacing="2" align="center" bordercolor="#660099" bgcolor="#CCFFFF">
<tr>
<th><font color="#000099">Nombre Grupo</font></th>
<th><font color="#000099">Trabajador</font></th>
<th><font color="#000099">Servicio</font></th>
<th><font color="#000099">Mes</font></th>
<th><font color="#000099">Plan</font></th>
<th><font color="#000099">Real</font></th>
</tr>
EOD;
// echo $cumplimiento;

$detalles '';
while (
$row mysql_fetch_array($resultado)) {
   
$nombre_grupo $row ['nombregrupo'];   
   
$nombre_trabajador $row ['nombreworker'];   
   
$servicio $row ['nombreserv'];
   
$mes $row ['Mes'];  
   
$plan $row ['PLAN'];
   
$real $row ['PROD'];   
   
$detalles .=<<<EOD
 <tr>
  <td align = "center"><strong><font color="#990000">$nombre_grupo</font></strong></td>  
  <td align = "center"><strong><font color="#990000">$nombre_trabajador</font></strong></td>
  <td align = "center"><strong><font color="#990000">$servicio</font></strong></td>
  <td align = "center"><strong><font color="#990000">$mes</font></strong></td>
  <td align = "center"><strong><font color="#990000">$plan</font></strong></td>
  <td align = "center"><strong><font color="#990000">$real</font></strong></td>  
</tr>
EOD;
}

$detalles .=<<<EOD
  <tr>
  <td>&nbsp;</td>
  </tr>
  <tr>
  <td>Total :$registros</td>
</tr>
EOD;

$pie "</table>";
$cumplimiento =<<<CUMPLIMIENTO
       $encabezamiento
       $detalles
       $pie
CUMPLIMIENTO;
echo 
"Hay $registros registros en la base de datos.";
echo 
$cumplimiento;
?>
Saludos.