Guest User

Untitled

a guest
Oct 19th, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. Class dbObj{
  2. var $servername = "localhost";
  3. var $username = "root";
  4. var $password = "";
  5. var $dbname = "test";
  6. var $conn;
  7. function getConnstring() {
  8. $con = mysqli_connect($this->servername, $this->username, $this->password, $this->dbname) or die("Connection failed: " . mysqli_connect_error());
  9.  
  10. /* check connection */
  11. if (mysqli_connect_errno()) {
  12. printf("Connect failed: %sn", mysqli_connect_error());
  13. exit();
  14. } else {
  15. $this->conn = $con;
  16. }
  17. return $this->conn;
  18. }
  19. }
  20.  
  21. ?>
Add Comment
Please, Sign In to add comment