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
请问我哪里出问题了?谢谢。