Ver Mensaje Individual
  #15 (permalink)  
Antiguo 08/07/2015, 15:57
juan_salinas_aedo
 
Fecha de Ingreso: julio-2015
Mensajes: 11
Antigüedad: 8 años, 9 meses
Puntos: 0
Respuesta: Problemas para trabajar con fechas en PHP

Cita:
Iniciado por xfxstudios Ver Mensaje
Mas arriba te coloque unos codigos con el while, juega con ellos y listo ahi te sale
Al fin pude sacarlo y lo deje así:

<?php
$con = mysqli_connect('localhost', 'root', '', 'gimnasio');
$id=$_POST["id"];
$rut=$_POST["rut"];
$link="select Fecha_ingreso from `gym` WHERE id='$id' or rut='$rut'";
$result = mysqli_query($con, $link);

while ($registro = mysqli_fetch_array($result)){
$fechainicio = $registro['Fecha_ingreso'];
$fechafin = strtotime ('+30 day', strtotime ( $fechainicio));
$fechafin = date ('Y-m-d', $fechafin);


if($fechafin < date("Y-m-d"))
{
$msg = "<span class='texto_rojo'>Contrato Vencido</span>";
}
else if($fechafin == date("Y-m-d")){
$msg = "<span class='texto_rojo'>Contrato vence HOY</span>";
}
else {
$msg = "<span class='texto_azul'>Contrato Vigente</span>";
}
echo $msg."<br>";
}
?>

Muchas gracias!!!