Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/04/2016, 09:04
Avatar de el_cesar
el_cesar
 
Fecha de Ingreso: mayo-2001
Ubicación: Cali
Mensajes: 2.423
Antigüedad: 23 años
Puntos: 20
En hosting funciona bien y en localhost no

Tengo este código
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><meta http-equiv="Content-Type" content="text/html; charset=gb18030">
  4.  
  5. <title>Brillaseo - Manejo de Eventuales</title>
  6. <link href="estilos.css" rel="stylesheet" type="text/css" />
  7. <link href="css/calendario.css" type="text/css" rel="stylesheet">
  8. <script src="js/calendar.js" type="text/javascript"></script>
  9. <script src="js/calendar-es.js" type="text/javascript"></script>
  10. <script src="js/calendar-setup.js" type="text/javascript"></script>
  11. </head>
  12.  
  13. <body>
  14. <?php
  15. //cEStablecemos conexion a la base de datos
  16. include('conexion.php');
  17. //Definimos la zona horaria para Colombia
  18. date_default_timezone_set('America/Bogota');
  19.  
  20. $fecha_solicitud = date("Y-m-d H:i:s");
  21. //Recibo la variable para el titulo
  22.  
  23. $tit=$_GET['va'];
  24. switch ($tit){
  25.     case  1:
  26.     $titulo ="Asignaci&oacute;n de Eventuales";
  27.     break;
  28.     case 2:
  29.     $titulo ="Asignaci&oacute;n de &Oacute;rdenes de Compra";
  30.     break;
  31.     case 3:
  32.     $titulo ="Asignaci&oacute;n de Servicios Especiales";
  33.     break;
  34.    
  35. }
  36. ?>
  37. <form id="form1" name="form1" method="post" action="consulta.php">
  38.   <input type="hidden" name="fecha_solicitud" value="<?php echo $fecha_solicitud; ?>" />
  39.   <input type="hidden" name="va" value="<?php echo $tit; ?>" />
  40.   <table width="40%" border="0" align="center">
  41.   <tr>
  42.     <td><table width="100%" border="0">
  43.       <tr>
  44.         <td width="13%"><img src="logo_jpg.png" width="150" height="150" /></td>
  45.         <td width="87%"><h1><?php echo $titulo ?></h1></td>
  46.       </tr>
  47.     </table></td>
  48.   </tr>
  49.   <tr>
  50.     <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="repblue">
  51.       <tr>
  52.         <td width="23%">Solicitante</td>
  53.         <td width="38%"><select name="supervisor">
  54.         <option value="" selected="selected"> </option>
  55.           <?php
  56.     $query4 = "SELECT * FROM Supervisores order by Nombre ASC";
  57.     $result4= mysql_query($query4);
  58.  
  59.     while ( $row4 = mysql_fetch_array($result4) )
  60.     {
  61.         ?>
  62.           <option value="<?php echo $row4['id_super'] ?>" > <?php echo $row4['Nombre']; ?> </option>
  63.           <?php
  64.     }
  65.     ?>
  66.         </select></td>
  67.         <td width="11%">Cargo</td>
  68.         <td width="28%"><select name="cargo">
  69.         <option value="" selected="selected"> </option>        
  70.           <option value="Asistente">Asistente</option>
  71.           <option value="Coordinador">Coordinador</option>
  72.           <option value="Cliente">Cliente</option>
  73.           <option value="Director">Director</option>
  74.           <option value="Operario">Operario</option>
  75.           <option value="Supervisor">Supervisor</option>
  76.         </select></td>
  77.       </tr>
  78.     </table></td>
  79.   </tr>
  80.   <tr>
  81.     <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="repblue">
  82.       <tr>
  83.         <td width="23%">Mantenimiento</td>
  84.         <td width="77%"><select name="mantenimiento" class="lista">
  85.         <option value="" selected="selected"> </option>        
  86.           <?php
  87.     $query = 'SELECT * FROM Cliente order by Cliente ASC';
  88.     $result= mysql_query($query);
  89.  
  90.     while ( $row = mysql_fetch_array($result) )
  91.     {
  92.         ?>
  93.           <option value="<?php echo $row['id_cliente'] ?>" > <?php echo $row['cliente']; ?> </option>
  94.           <?php
  95.     }
  96.     ?>
  97.         </select></td>
  98.       </tr>
  99.     </table></td>
  100.   </tr>
  101.   <tr>
  102.     <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="repwhite">
  103.       <tr>
  104.         <td width="23%">Operario Novedad</td>
  105.         <td width="77%"><select name="operario">
  106.         <option value="" selected="selected"> </option>
  107.           <?php
  108.     $query3 = 'SELECT * FROM Operarios order by Nombre ASC';
  109.     $result3= mysql_query($query3);
  110.  
  111.     while ( $row3 = mysql_fetch_array($result3) )
  112.     {
  113.         ?>
  114.           <option value="<?php echo $row3['Id_operario'] ?>" > <?php echo $row3['Nombre']; ?> </option>
  115.           <?php
  116.     }
  117.     ?>
  118.         </select>
  119.           <?php
  120.  
  121. $fecha_registro=date("Y-m-d h:i:s");
  122. ?></td>
  123.       </tr>
  124.     </table></td>
  125.   </tr>
  126.   <tr>
  127.     <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="repblue">
  128.       <tr>
  129.         <td width="23%">Tipo de Novedad</td>
  130.         <td width="77%"><select name="novedad">
  131.         <option value="" selected="selected"> </option>        
  132.           <?php
  133.     $query2 = 'SELECT * FROM Causas order by Causa ASC';
  134.     $result2= mysql_query($query2);
  135.  
  136.     while ( $row2 = mysql_fetch_array($result2) )
  137.     {
  138.         ?>
  139.           <option value="<?php echo $row2['id_causa'] ?>" > <?php echo $row2['causa']; ?> </option>
  140.           <?php
  141.     }
  142.     ?>
  143.         </select></td>
  144.       </tr>
  145.     </table></td>
  146.   </tr>
  147.   <tr>
  148.     <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="repwhite">
  149.       <tr>
  150.         <td width="11%">Inicia</td>
  151.         <td width="27%"><input type="text" name="fecha_inicio" id="ingreso" value="yyyy-mm-dd"  width="90" class="cal" />
  152.           <img src="ima/calendario.png" alt="r" width="16" height="16" id="lanzador" title="Fecha Inicial" border="0" />
  153.           <!-- script que define y configura el calendario-->
  154.           <script type="text/javascript">
  155.    Calendar.setup({
  156.     inputField     :    "ingreso",     // id del campo de texto
  157.      ifFormat     :     "%Y-%m-%d",     // formato de la fecha que se escriba en el campo de texto
  158.      button     :    "lanzador"     // el id del botón que lanzará el calendario
  159. });
  160.       </script></td>
  161.         <td width="10%"> D&iacute;as</td>
  162.         <td width="11%"><input type="text" name="dias" id="textfield3" class="inputdias" width="40" /></td>
  163.         <td width="13%">Finaliza</td>
  164.         <td width="28%"><input type="text" name="fecha_fin" id="ingreso1" value="yyyy-mm-dd" width="90" class="cal"/>
  165.           <img src="ima/calendario.png" alt="c" width="16" height="16" id="lanzador1" title="Fecha Final" border="0" />
  166.           <!-- script que define y configura el calendario-->
  167.           <script type="text/javascript">
  168.    Calendar.setup({
  169.     inputField     :    "ingreso1",     // id del campo de texto
  170.      ifFormat     :     "%Y-%m-%d",     // formato de la fecha que se escriba en el campo de texto
  171.      button     :    "lanzador1"     // el id del botón que lanzará el calendario
  172. });
  173.       </script></td>
  174.       </tr>
  175.     </table></td>
  176.   </tr>
  177.  
  178.   <tr>
  179.     <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="repblue">
  180.       <tr>
  181.         <td width="23%">Perfil</td>
  182.         <td ><select name="habilidad">
  183.         <option value="" selected="selected"> </option>        
  184.           <option value="Hospitalario">Hospitalario</option>
  185.           <option value="Jardinero">Jardinero</option>
  186.           <option value="Operario de Aseo">Operario</option>
  187.           <option value="Piscinero">Piscinero</option>
  188.           <option value="Piscinero-Jardinero">Piscinero-Jardinero</option>
  189.           <option value="Todero">Todero</option>
  190.  
  191.         </select></td>
  192.         <td width="10%">Turno</td>
  193.         <td width="47%"><select name="turno">
  194.         <option value="" selected="selected"> </option>        
  195.           <option value="7:30-12:30">7:30-12:30</option>
  196.           <option value="7:30-12:30">12:30-5:30</option>
  197.           <option value="7:30-12:30">7:30-12:30 Sabado</option>
  198.         </select></td>
  199.       </tr>
  200.     </table></td>
  201.   </tr>
  202.   <tr>
  203.     <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="repwhite">
  204.       <tr>
  205.         <td width="17%">Observaciones</td>
  206.         <td width="83%"><textarea name="obs" cols="54" rows="2"></textarea></td>
  207.       </tr>
  208.     </table></td>
  209.   </tr>
  210.   <tr>
  211.     <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
  212.       <tr>
  213.         <td width="13%"><div class="btn2"><a href="index.php">Inicio</a></div></td>
  214.         <td width="15%">&nbsp;</td>
  215.         <td width="67%">&nbsp;</td>
  216.         <td width="5%"><input type="submit" name="button" id="button" value="Buscar" class="btn4" width="150px"/></td>
  217.         </tr>
  218.       </table></td>
  219.   </tr>
  220.   <tr>
  221.     <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="fila">
  222.       <tr>
  223.         <td >
  224.          
  225.           </td>
  226.         </tr>
  227.       </table></td>
  228.   </tr>
  229. </table>
  230.   <p>&nbsp;</p>
  231. </form>
  232. </body>
  233. </html>
Resulta que en el hosting funciona bien, sin embargo, cuando lo intento trabajar en el localhost para hacer pruebas y correcciones me dá el siguiente error:

Cita:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\ordenesdecompra2\app.php on line 59
Ya verifiqué la conexión a la bd y está bien, privilegios de usuario y estan bien, Probé la consulta en mysql y ejecuta bien y trae resultados, lo que me parece curioso es que intenté hacer un echo de $query4 y no me muestra nada.
__________________
Say no more.......