Foros del Web » Programando para Internet » PHP »

[SOLUCIONADO] error con mktime

Estas en el tema de error con mktime en el foro de PHP en Foros del Web. tengo este error: Cita: Warning: mktime() expects parameter 6 to be long, string given in /home*********.php(48) : eval()’d code on line 197 este es mi ...
  #1 (permalink)  
Antiguo 23/01/2014, 09:10
Avatar de el_cesar  
Fecha de Ingreso: mayo-2001
Ubicación: Cali
Mensajes: 2.423
Antigüedad: 22 años, 10 meses
Puntos: 20
error con mktime

tengo este error:

Cita:
Warning: mktime() expects parameter 6 to be long, string given in /home*********.php(48) : eval()’d code on line 197
este es mi codigo

Código PHP:
Ver original
  1. if ($cliente == '1' or empty($cliente) ) {} else {
  2.     // hacemos la consulta en la base de datos
  3.     $consulta = "SELECT * FROM OM_Oportunidad WHERE idCliente ='$cliente'";
  4.     $corre_consulta = mysql_query($consulta) or die (mysql_error());
  5.  
  6.     $numero_filas = mysql_num_rows($corre_consulta);
  7.  
  8.     if ($numero_filas == '0' ) { echo "En el momento No existen OPM registradas para el Cliente indicado, por favor intente de nuevo"; } else {
  9.        
  10.             while ($res = mysql_fetch_array($corre_consulta)) {
  11.             //formateamos las fechas
  12.             //Fecha Inicial
  13.             $fecha_inicial = $res['3'];
  14.             $explotado = explode('-',$fecha_inicial);
  15.             $dia_inicial=$explotado[2];
  16.             $mes_inicial=$explotado[1];
  17.             $anno_inicial=$explotado[0];
  18.             $meses = array('Enero ','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre');
  19.             $mact = $meses[$mes_inicial - 1];
  20.             $fecha_inicio=$mact;
  21.             $fecha_inicio.=$dia_inicial;
  22.             $fecha_inicio.=' de ';
  23.             $fecha_inicio.=$anno_inicial;
  24.             //Fecha Entrega Plan de Accion
  25.             $fecha_entrega = $res['13'];
  26.             $explotado2 = explode('-',$fecha_entrega);
  27.             $dia_entrega=$explotado2[2];
  28.             $mes_entrega=$explotado2[1];
  29.             $anno_entrega=$explotado2[0];
  30.             $meses2 = array('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre');$ment=$meses2[$mes_entrega-1];
  31.             $fecha_entrega=$ment;
  32.             $fecha_entrega.=$dia_entrega;
  33.             $fecha_entrega.=' de ';
  34.             $fecha_entrega.=$anno_entrega;
  35.             echo '
  36.             ';
  37.             //Calculamos fecha pendiente o atrazada
  38.             //Traemos Fecha de Hoy
  39.             $ano_hoy = date('Y');
  40.             $mes_hoy = date('m');
  41.             $dia_hoy = date('d');
  42.             //Hacemos el timestamp para cada fecha
  43.            
  44.             $timestamp_entrega = mktime(0,0,0,$mes_entrega,$dia_entrega,$anno_entrega);
  45.             $timestamp_hoy = mktime (0,0,0,$mes_hoy, $dia_hoy, $ano_hoy);
  46.            
  47.             //Restamos las fechas
  48.            
  49.             $faltan_segundos = $timestamp_entrega - $timestamp_hoy;
  50.            
  51.             //Convertimos el resultado a dias
  52.            
  53.             $faltan_dias = $faltan_segundos / (60 * 60 * 24);

La linea 197 es esta
Código PHP:
Ver original
  1. $timestamp_entrega = mktime(0,0,0,$mes_entrega,$dia_entrega,$anno_entrega);

Por que me sale ese warning?
__________________
Say no more.......
  #2 (permalink)  
Antiguo 23/01/2014, 09:19
Avatar de enlinea777  
Fecha de Ingreso: mayo-2008
Ubicación: frente al pc
Mensajes: 1.830
Antigüedad: 15 años, 10 meses
Puntos: 127
Respuesta: error con mktime

deberias imprimir $mes_entrega,$dia_entrega,$anno_entrega para ver si estas tomando los parametros adecuados
  #3 (permalink)  
Antiguo 23/01/2014, 09:42
Avatar de el_cesar  
Fecha de Ingreso: mayo-2001
Ubicación: Cali
Mensajes: 2.423
Antigüedad: 22 años, 10 meses
Puntos: 20
Respuesta: error con mktime

Gracias, enlinea, al imprimir esos campos me dí cuenta que estaba tomando el campo incorrecto en la base de datos.
__________________
Say no more.......

Etiquetas: fecha, mktime, mysql, select
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:13.