Last active
December 16, 2015 14:04
-
-
Save nepsdotin/221d5885e9e821e68b2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//database class | |
class database | |
{ | |
protected $host; | |
protected $user; | |
protected $password; | |
protected $dbname; | |
protected $conxn; | |
public $result; | |
public function __construct() | |
{ | |
$this->host="localhost"; | |
$this->user="root"; | |
$this->password=""; | |
$this->dbname="sms"; | |
$this->conxn=mysqli_connect($this->host,$this->user,$this->password,$this->dbname); | |
if(!$this->conxn) | |
{ | |
$this->errorMessage(mysqli_error($this->conxn)); | |
} | |
} | |
//error message | |
public function errorMessage($message) | |
{ | |
return $message; | |
} | |
public function successMessage($msg) | |
{ | |
return $msg; | |
} | |
//executing the query..yo function le pass gareko sab query haru run garxa | |
public function execute($query) | |
{ | |
$this->result=mysqli_query($this->conxn,$query); | |
if(!$this->result) | |
{ | |
$this->errorMessage(mysqli_error($this->conxn)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment