致命错误:调用未定义的方法mysqli\u stmt::bindvalue()

new9mtju  于 2021-06-24  发布在  Mysql
关注(0)|答案(0)|浏览(146)

我需要以下代码的帮助。我得到这个错误:
致命错误:在c:\xampp\htdocs\mymind2\function.php的第28行调用未定义的方法mysqli\u stmt::bindvalue()
当我运行它的时候

<?php
class  Main{
    //fetching posts from database
    public function posts(){
        global $conn;
        $query = $conn->prepare("SELECT * FROM `posts`,`users` WHERE userId = user_id_p ORDER BY `post_id` DESC");
        $query->execute();
        return $query->fetchAll();
    }
    //add new post if user post 
    public function add_post($user_id,$status,$file_parh){
        global $conn; 
        if(empty($file_parh)){
            $file_parh = 'NULL';
        }
        $query = $conn->prepare('INSERT INTO `posts` (`post_id`, `user_id_p`, `status`, `status_image`, `status_time`) VALUES (NULL, ?, ?,?,  CURRENT_TIMESTAMP)');
        $query->bindValue(1,$user_id);
        $query->bindValue(2,$status);
        $query->bindValue(3,$file_parh);
        $query->execute();
        header('Location: home.php?id='.$_POST['email']);
    }
    //fetch user data by user id 
    public function user_data($user_id){
        global $conn;
        $query = $conn->prepare('SELECT * FROM users WHERE userId = ?');

        //Line 28 below

        $query->bindvalue(1,$user_id);
        $query->execute();

        return $query->fetch();
    }
}
?>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题