Ver Mensaje Individual
  #4 (permalink)  
Antiguo 25/01/2011, 07:56
rutanga
 
Fecha de Ingreso: julio-2006
Ubicación: Concepción
Mensajes: 66
Antigüedad: 17 años, 9 meses
Puntos: 0
Respuesta: Comparar fechas, no imprime diferencia

Código PHP:
Ver original
  1. <?
  2. $fecha_hoy = time();
  3. $conexion = mysql_connect("localhost","","");
  4.     mysql_select_db("");
  5.  
  6.     $sql = "SELECT fecha_entrega FROM cot_interna ORDER BY fecha_entrega ASC LIMIT 10";
  7.     $consulta = mysql_query($sql,$conexion);
  8.  
  9. while ($row = mysql_fetch_array($consulta))
  10.  
  11.            {
  12. // convierto la fecha que esta en la myqsl al mismo formato de la $fecha_hoy
  13.          
  14.           $fecha_entrega_unix=strtotime("$row[fecha_entrega]");
  15.          
  16.         echo "FECHA ENTREGA UNIX: $fecha_entrega_unix";
  17.         echo "FECHA HOY UNIX: $fecha_hoy </br>";
  18.  
  19.  
  20.         if($row[fecha_entrega_unix] > $row[fecha_hoy]){  // aqui era un > no un -      .... pero aun sigue el error
  21.  
  22.         $diferencia= $fecha_entrega_unix - $fecha_hoy;
  23.         echo " DIFERENCIA: $diferencia";
  24.                                             }
  25.     }
  26. ?>


no imprime ni siquiera la palabra DIFERENCIA... no pasa el if