SHARE
TWEET

Untitled

ahmadsaepudin Jun 5th, 2017 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. Class dbObj{
  3.     /* Database connection start */
  4.     var $servername = "localhost";
  5.     var $username = "root";
  6.     var $password = "";
  7.     var $dbname = "test";
  8.     var $conn;
  9.     function getConnstring() {
  10.         $con = mysqli_connect($this->servername, $this->username, $this->password, $this->dbname) or die("Connection failed: " . mysqli_connect_error());
  11.  
  12.         /* check connection */
  13.         if (mysqli_connect_errno()) {
  14.             printf("Connect failed: %s\n", mysqli_connect_error());
  15.             exit();
  16.         } else {
  17.             $this->conn = $con;
  18.         }
  19.         return $this->conn;
  20.     }
  21. }
  22.  
  23. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top