select_db不选择指定的数据库

时间:2019-03-17 00:48:17

标签: php database mysqli

mysqli连接方法:

class dbconn {    
    public function connect() {
        $servername = "localhost";
        $username = "user";
        $password = "user_pass";
        $dbname = "db";

        //to return the db connection
        $conn = new mysqli($servername, $>username, $password, $dbname);
        return $conn;
    }
}

在我包含上述文件的文件中

$this->connect()->select_db("new_db_name"); //does not select "new_db_name", instead it remains in the default db

请问我哪里出问题了?谢谢。

0 个答案:

没有答案