错误:致命错误:在第10行的/home/u526894334/public_html/includes/class/admin.class.php中调用非对象的成员函数prepare()
admin.class.php代码:
class admin extends system {
public function login($username,$password) {
$username = htmlspecialchars($username);
$password = htmlspecialchars($password);
$query = $this->PDO->prepare("SELECT `id` FROM `admin` WHERE `username`=? AND `password`=?");
$query->execute(array($username,$password));
$count = $query->rowCount();
if($count == 1) {
$info = $query->fetch(PDO::FETCH_ASSOC);
$_SESSION['aid'] = $info['id'];
header("Location:index.php?id=admin_web_settings");
}else{
echo "<div class='alert alert-danger'>Neteisingas slapyvardis / slaptažodis!</div>";
}
}
........
system.class.php代码:
class system {
var $isConnected = false,
$ConnectionError = false,
$pdo = null;
public function __construct(){
try{
$this->PDO = new PDO('mysql:host=mysql.2freehosting.com; dbname=u526894334_vvp;charset=utf8', 'u526894334_vvp', 'my_password',array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
$this->isConnected = true;
}
catch(PDOException $ex){
$this->isConnected = false;
$this->ConnectionError = $ex;
}
}..........
config.php代码:http://hastebin.com/oxonajohoh.php