I have been getting some troubles with my class, could I count on you to help me solve that?
well, let's go.
This is my DB class which has a constructor to instantiate the ADODB class and provide me a objective of it:
include_once('adodb/adodb.inc.php');
class idatabase {
private $host = 'localhost';
private $user = 'root';
private $password = '';
private $driver = 'mysql';
private $db = 'db';
public $m_objConnection;
public $p_objConnection;
static private $instance;
public function __construct() {
define('ADODB_FETCH_DEFAULT',0);
define('ADODB_FETCH_NUM',1);
define('ADODB_FETCH_ASSOC',2);
define('ADODB_FETCH_BOTH',3);
$m_objConnection =& ADONewConnection($this->driver);
//do the connection
$m_objConnection->Connect($this->host,$this->user,$this->password,$this->db);
$this->m_objConnection = $p_objConnection;
//retrieves me the object of ADODB class
return $this->p_objConnection;
}
//is it right?
static public function singleton()
{
if (!isset(self::$instance)) {
$c = __CLASS__;
self::$instance = new $c;
}
return self::$instance;
}
public function __destruct(){
unset($this->connection);
}
}
My authentication class:
class Iuser{
private $m_UserID;
private $m_UserPassword;
private $m_DB;
private $m_DatabaseConnected;
public function __construct($id,$password) {
include_once('idatabase.class.php');
$this->m_DB = idatabase::singleton();
$this->setId($id);
$this->setPassword($password);
}
//setting id and password
private function setId($id){
$this->m_UserID = $id;
}
private function setPassword($password){
$this->m_UserPassword = $password;
}
//gets methods
public function getId(){
return $this->m_UserID;
}
public function getPassword(){
return $this->m_UserPassword;
}
//Method checks id/password and returns if it is valid
public function isValid(){
$show = $this->m_DB->GetRow("SELECT * FROM login WHERE User_Id_FK='".$this->m_UserID."' AND Password='".$this->m_UserPassword."'");
}
public function __destruct(){
unset($this->m_DB);
}
My script:
include "iuser.class.php";
//test with iuser class
$isValid = new Iuser('fil@fil.com','c6d66241bcd6b3fede4328e028d06dfc ');
// it tests if id and login inputted by user is valid using method`s iuser class
if ($isValid->isValid()){
echo "isValid";
}else
{
echo "Id/Password error!";
}
So, when I execute the script, it throws me that error:
Fatal error: Call to undefined method idatabase::GetRow() in C:\xampp\htdocs\LOGIN\iuser.class.php on line 44
I've looking very hard to solve, but, I've got no ideas anymore.
could Anyone help me?

New Topic/Question
Reply




MultiQuote



|