Possible Duplicate:
Reference - What does this error mean in PHP?
I saw many questions about my problem, but, unfortunately, without fix.
So, my syntax's error is:
Fatal error: Using $this when not in object context in ... on line 18.
My line 18:
echo $this->login;
My full code:
<?php
class LoginModel extends LoginController {
private $_db;
public $login;
public $pass;
public function __construct() {
$this->_db = Db::getInstance();
$this->login = addslashes(trim($_GET['tgo-root-user']));
$this->pass = addslashes(trim(md5($_GET['tgo-root-password'].SALT)));
}
public function auth() {
echo $this->login;
/*$pdo = $this->_db->prepare( "SELECT * FROM `tgo_users` WHERE ((:login = `user_login`) OR (:login = `user_email`)) AND (:user_pw = `user_pw`) " );
$pdo->bindParam( ":login", $this->login, PDO::PARAM_STR );
$pdo->bindParam( ":user_pw", $this->pass, PDO::PARAM_STR );
$pdo->execute();
if( $pdo->rowCount() == 1 ) {
return true;
} else {
return false;
}*/
}
}
My call:
<?php
class LoginController {
public static $status;
public function authenticate() {
$model = new LoginModel();
$this->status = $model->auth();
LoginView::emitAuthResponse();
}
}
So I ask: what's wrong? Damn.. I'm loosing to much time with this problem and I don't know what's wrong.
Thank you.