Advertisement
Guest User

Untitled

a guest
Mar 16th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. class dbconn {
  2. public function connect() {
  3. $servername = "localhost";
  4. $username = "user";
  5. $password = "user_pass";
  6. $dbname = "db";
  7.  
  8. //to return the db connection
  9. $conn = new mysqli($servername, $>username, $password, $dbname);
  10. return $conn;
  11. }
  12. }
  13.  
  14. $this->connect()->select_db("new_db_name"); //does not select "new_db_name", instead it remains in the default db
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement