Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //require_once ("new_config.php");
- class Database {
- public $connection;
- function __construct(){
- $this->open_db_connection();
- }
- public function open_db_connection(){
- $this->connection = new mysqli(DB_HOST,DB_USER,DB_PASS,DB_NAME);
- if($this->connection->errno) {
- die("Database connection failed badly". " ".$this->connection->connect_error);
- }
- }
- public function query($sql){
- $result = $this->connection->query($sql);
- return $result;
- }
- private function confirm_query(){
- if(!$result){
- die("Query Failed". " ".$this->connection->connect_error);
- }
- }
- public function escape_string($string){
- $escaped_string = $this->connection->real_escape_string($string);
- return $escaped_string;
- }
- public function the_insert_id() {
- return $this->connection->insert_id;
- }
- }
- $database = new Database();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement