致命错误:调用未定义的方法mysqli_stmt :: bindvalue()

时间:2018-04-26 09:44:02

标签: php mysql

我需要以下代码的帮助。 我收到这个错误:

  

致命错误:调用未定义的方法mysqli_stmt :: bindvalue()   第28行的C:\ xampp \ htdocs \ MyMind2 \ function.php

我跑的时候

<?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();
    }
}
?>

0 个答案:

没有答案