小编use*_*649的帖子

调用未定义的方法PDO :: execute()

我正在尝试编写页面登录代码,但我在这个错误中停了下来

PLIZ告诉我这里的错误

<?php
@session_start();
include("../../connexion/connexion.php");
class login_class {
        public $user;
        public $password;
        public $connexion;
    public function check_login() {
        try {
            $cn = new class_connect();
            $this->connexion = $cn->connect(null);
            $result = $this->connexion->execute("select * from user where username='$this->user' and password='$this->password'");

                        $data = $result->fetchAll(PDO::FETCH_OBJ);


            if (!empty($data[0]->id_user)) {
                return true;
            }else {
                return false;
            }
        }catch(PDOException $ex) {  
            echo $ex->getMessage();
        }
    }
    public function __construct($user) {
        if($user){
            $this->user = $user["username"];
            $this->password = $user["password"];
        }
    }

}
?>
Run Code Online (Sandbox Code Playgroud)

php pdo

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

pdo ×1

php ×1