Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class MySQL_Connection{
- protected $database;
- protected function __construct($user, $password, $host){
- try{
- $RDBMS = strtolower('MySQL');
- $DBName = strtolower('DBName');
- $this->database = new PDO($RDBMS.":host"."=".$host.";".$DBName."="."PDirectory", $user, $password);
- }catch(PDOException $Exception){
- print $Exception->getMessage();
- exit;
- }
- }
- protected function __destruct(){
- $this->database = NULL;
- }
- }
- ?>
- <?php
- require 'MySQL/Connect.php';
- class MySQL_Login extends MySQL_Connection{
- private $QueryResult;
- public function __construct($user, $password, $host = 'localhost'){
- parent::__construct($user, $password, $host);
- }
- public function __destruct(){
- parent::__destruct();
- }
- public function MySQL_Query($Username, $Password, $PIN, $ID){
- $Password = strtoupper(MD5($Password));
- $PIN = strtoupper(MD5($PIN));
- //Code the giving error -->
- $Query = MySQL_Connection::$connection->prepare("SELECT * FROM Users WHERE Username = ? AND Password = ? AND PIN = ? AND ID = ?");
- //Code the giving error <--
- $Query->execute(array(
- $Username,
- $Password,
- $PIN,
- $ID
- ));
- $row = $Query->fetch(PDO::FETCH_ASSOC);
- if($row['ID'] != NULL){
- $this->QueryResult = $row['ID'];
- }else {
- $this->QueryResult = FALSE;
- }
- }
- public function result() {
- return $QueryResult;
- }
- }
- ?>
- PHP Notice: Accessing static property MySQL_Login::$database as non
- static in MySQL/Connect.php on line 17 -
- PHP Fatal error: Uncaught Error: Access to undeclared static property:
- MySQL_Connection::$connection in Login.php on line 17 -
- Thrown in Login.php on line 17 -
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement