I have this error:
Notice: Undefined variable: password in C: \ xampp \ htdocs \ iedan \ model \ UserDao.php on line 37
here is the code
<?php
include 'Conexion.php';
include '../entidades/Usuario.php';
class UsuarioDao extends Conexion
{
protected static $cnx;
private static function getConexion()
{
self::$cnx = Conexion::conectar();
}
private static function desconectar()
{
self::$cnx = null;
}
/**
* metodo para validar el login
*
* @param object $usuario
* @return boolean
*/
public static function login($usuario)
{
$query = "SELECT id, nombre, usuario, rol, fecha_registro FROM usuarios WHERE usuario = :usuario AND password = :password";
self::getConexion();
$resultado = self::$cnx->prepare($query);
$resultado->bindValue(":usuario", $usuario->getUsuario());
$resultado->bindValue(":password", $password->getPassword()); //esta linea es la del error
$resultado->execute();
if($resultado->rowCount() > 0) {
return "ok";
}
return "falso";
}
}
tells me that the variable is not defined, but they are all defined here:
<?php
/**
*
*/
class Usuario
{
private $id;
private $nombre;
private $usuario;
private $password;
private $rol;
private $fecha_registro;
public function getId(){
return $this->id;
}
public function setId($id){
$this->id = $id;
}
public function getNombre(){
return $this->nombre;
}
public function setNombre($nombre){
$this->nombre = $nombre;
}
public function getUsuario(){
return $this->usuario;
}
public function setUsuario($usuario){
$this->usuario = $usuario;
}
public function getPassword(){
return $this->password;
}
public function setPassword($password){
$this->password = $password;
}
public function getRol(){
return $this->rol;
}
public function setRol($rol){
$this->rol = $rol;
}
public function getFecha_registro(){
return $this->fecha_registro;
}
public function setFecha_registro($fecha_registro){
$this->fecha_registro = $fecha_registro;
}
}
If someone can tell me what is due, Thank you in advance.