Jump to content

[28-Feb-2011 14:48:37] PHP Warning: checkdate() expects parameter 1 to be long,


pedromsouza

Recommended Posts

When I use a method within a class, I get this error:

 

[28-Feb-2011 14:48:37] PHP Warning:  checkdate() expects parameter 1 to be long, string given in /Applications/MAMP/htdocs/classe_PreparaData.inc on line 17

 

Class Itself

 

class PreparaData {

 

public $saida;

 

function validar_input ($entrada) {

 

if(!(strlen($entrada)==10) and (strstr($entrada,'/')))

{echo "A data deve respeitar a formatação dd/mm/aaaa!<br>";}

}

 

function montar_timestamp ($entrada) {

$a_partes=explode("/",$entrada);

echo $a_partes[1].$a_partes[0].$a_partes[2].'<br>';

if(checkdate('$a_partes[1]','$a_partes[0]','$a_partes[2]'))

{function exibir_data ($a_partes){

if(!(empty($a_partes)))

{echo "$a_partes[1].$a_partes[0].$a_partes[2]";}

;};}

else

{echo "Data inválida!<br>"; var_dump($a_partes);}

}

 

function gravar_output ($saida) {

$query=mysql_query("insert into tabela value ('$saida')");

}

}

?>

 

Help!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.