Error in PHP: Array to string conversion in

0

I get this error, they could help me

  

Notice: Array to string conversion in   C: \ xampp \ htdocs \ EPWeb \ Admin \ Control \ ControlUsuario.php on line 14

This is the code:

function IngresarUsuario($nombreusuario,$apellidousuario,$nacionalidadusuario,$cedulausuario, $pasaporteusuario,$correousuario,$profesionusuario,$telefonousuario)
{
    $mensaje = "";

    if(isset($nombreusuario,$apellidousuario,$nacionalidadusuario,$cedulausuario,$correousuario,$profesionusuario, $telefonousuario))
    {

        $tipoUsuario = "1";
        $FechaUsuario = getdate();

        $query = "INSERT INTO persona(nombrep, apellidop, nacionalidadp, cedulap, pasaportep, telefonop, correop, profesionp, fecha) VALUES ('".$nombreusuario."','".$apellidousuario."','".$nacionalidadusuario."','".$cedulausuario."','".$pasaporteusuario."','".$telefonousuario."','".$correousuario."','".$profesionusuario."','".$FechaUsuario."')";

    $con = conexionBD();
    $accion = mysqli_query($con,$query);

    if($accion)
    {
        $mensaje= "Correcto";
    }else
    {
        $mensaje= "No se pudo ejecutar la acción";
    }



    }else
    {
        $mensaje = "Los datos no fueron recibidos correctamente";
    }


    return $mensaje;
}
    
asked by Tevin Lectong 04.06.2018 в 19:31
source

1 answer

3

The getDate () method returns an element of type Array. You can use it in the following way:

$currDate = getDate(); // generas un llamado al metodo

$FechaUsuario = $currDate['year'] + "-" + $currDate['mon'] + "-" + $currDate['mday']; // y utilizas los valores regresados por el método

You can see more information on the official php documentation

    
answered by 04.06.2018 в 19:49