Login system pager error?
I've created a basic PHP login system as a personal project. I've finished all the pages but when I try and submit a username and password I get an error :
Fatal error: Call to a member function prepare() on a non-object in /home/(my username)/public_html/classes/Mysql.php on line 20
I've tinkered with it for a while but I haven't been able to find a solution, can anyone help me out?
<?php
require_once'includes/constants.php';
class Mysql {
private $conn;
function __contruct() {
$this->conn = new mysql (DB_SERVER, DB_USER, DB_PASSWORD,DB_NAME) or
die('Problem connecting to database');
}
function verify_Username_and_Pass($un, $pwd) {
$query = "SELECT *
FROM users
WHERE username = ? AND password = ?
LIMIT 1";
if($stmt = $this->conn->prepare($query)) {
$stmt->bind_param('ss', $un, $pwd);
$stmt->execute();
if($stmt->fetch()) {
$stmt->close();
return true;
}
}
}
}
