Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class db{
- private $host = "localhost";
- private $username = "root";
- private $password = "";
- private $db_name = "mydb";
- private $conn;
- protected function connect(){
- $this->conn = new mysqli($this->host, $this->username, $this->password, $this->db_name);
- if (mysqli_connect_errno()){
- printf("Connect failed: %s\n", mysqli_connect_error());
- exit();
- }
- return $this->conn;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment