Tengo un problema con una clase, en la cual extiendo la clase Conn que es mi conexión a base de datos. El error es
Class 'Conn' not found in ...
<?php
class User extends Conn{
private $nombre;
private $username;
public function ValidarExistencia($user, $password){
$md5pass = md5($password);
$sql = "SELECT * FROM usuario WHERE username = :user AND password = :password";
$query = $this->connect()->prepare($sql);
$query->execute(['user' => $user, 'password' => $md5pass]);
if($query->fetch(PDO::FETCH_ASSOC)){
return true;
}else{
return false;
}
}
public function SetUser($user){
$sql = "SELECT * FROM usuario WHERE username = :user";
$query = $this->connect()->prepare($sql);
$query->execute(['user' => $user]);
foreach ($query as $currentUser) {
$this->nombre = $currentUser['nombre'];
$this->username = $currentUser['username'];
}
}
public function getNombre(){
return $this->nombre;
}
}
?>
Código de la clase Conn:
<?php
class Conn
{
//Atributos de la base de datos
private $dbname;
private $host;
private $user;
private $pass;
private $port;
private $conexion;
//Métodos
public function __construct()
{
$this->dbname = "scrum";
$this->host = "localhost";
$this->user = "postgres";
$this->pass = "1234";
$this->port = "5432";
}
public function connect(){
try{
$this->conexion = new PDO("pgsql:host=".$this->host.
";port=".$this->port.
";dbname=".$this->dbname.
";user=".$this->user.
";password=".$this->pass);
}catch(Exception $e)
{
echo "Tienes el siguiente error:", $e->getMessage();
}
}
}
?>
Class User
si estas haciendo un require del archivo de laclass Conn
?