Advertisement
Guest User

Untitled

a guest
Apr 18th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL);
  3. class connectoDB
  4. {
  5.     public $host = 'localhost';
  6.     public $user = 'root';
  7.     public $pswd = 'rootPS';
  8.     public $base = 'lr';
  9.     public $connect; //the variable I will use to connect with the database
  10.     function todb()
  11.     {
  12.         if ($this->connect = (mysqli_connect($this->host, $this->user, $this->pswd, $this->base)) == true)
  13.         {
  14.            
  15.             echo "It works!!";
  16.         }
  17.         else
  18.         {
  19.             echo "No connection";
  20.         }
  21.        
  22.     }
  23. }
  24. $connect2db = new connectoDB;
  25. print $connect2db->todb();
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement