I get the following error:
Recoverable fatal error: Object of class User could not be converted to string in C: \ xampp \ htdocs \ iedan \ model \ Username.php on line 27.
I do not know what is due, here I leave the part of the code that throws me out of error
<?php
include 'conexion.php';
include '../entidades/Usuario.php';
class UsuarioDao extends Conexion{
protected static $cnx;
public static function getConexion(){
self::$cnx = Conexion::conectar();
}
private static function desconectar(){
self::$cnx = null;
}
//metodo para validar el login
public static function login($usuario){
$query = "SELECT id, nombre, usuario, email, privilegio, fecha_registro FROM usuarios WHERE usuario = :usuario AND password = :password";
self::getConexion();
$resultado = self::$cnx->prepare($query);
$resultado->bindParam(":usuario", $usuario); //aqui esta el error
$resultado->bindParam(":password", $password);
$resultado->excecute();
if(count($resultado)) {
return true;
}
return false;
}
}