Ver Mensaje Individual
  #8 (permalink)  
Antiguo 08/07/2015, 12:53
Avatar de xfxstudios
xfxstudios
 
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: Problemas para trabajar con fechas en PHP

Prueba de esta manera, a mi me funciono perfecto, me arrojo el siguente resultado:
Cita:
2015-07-08-Contrato Vigente
2015-07-05-Contrato vencido
Código PHP:
Ver original
  1. $mysqli = new MySQLi($hostname_seguridad, $username_seguridad, $password_seguridad, $database_seguridad);
  2. $result = $mysqli->query("SELECT * FROM fechas");
  3. $totalRows_result = mysqli_num_rows($result);
  4. while($row = mysqli_fetch_array($result))
  5. {
  6.     if($row['fecha'] < date("Y-m-d")) {
  7.         $msg = "Contrato vencido";
  8.     }
  9.     else {
  10.         $msg = "Contrato Vigente";
  11.     }
  12.     echo $row['fecha']."-".$msg."<br>";
  13. }