Advertisement
Guest User

Untitled

a guest
Aug 6th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.29 KB | None | 0 0
  1. <?php
  2.    
  3.     class DB{
  4.    
  5.         private $link_q="";
  6.         var $suc="";
  7.         var $connection_failed=false;
  8.         var $db_failed=false;
  9.        
  10.         public function _construct(){}
  11.        
  12.        
  13.         public function rp_connect($db_name="uid",$host="localhost",$user="root",$pass=""){        
  14.             $this->link_q=@mysql_connect($host,$user,$pass) or $this->ERROR_CONNECTION(true,'connection');
  15.             $this->suc=@mysql_select_db($db_name,$this->link_q) or $this->ERROR_CONNECTION(true,'db');
  16.         }
  17.        
  18.         public static function get_query($query_string){
  19.             return @mysql_query($query_string);
  20.                
  21.         }
  22.        
  23.         public function link_result(){
  24.             return $this->link_suc;
  25.         }
  26.         public function close_connection()
  27.         {
  28.             @mysql_close($this->link_q);
  29.         }
  30.        
  31.         public function ERROR_CONNECTION($failure=false,$type="connection"){
  32.             if($type=="connection"){
  33.                 $this->connection_failed=$failure;
  34.             }
  35.             else if($type=="db"){
  36.                 $this->db_failed=$failure;
  37.             }
  38.            
  39.         }
  40.        
  41.         public function close(){
  42.             @mysql_close($this->link_q);
  43.         }
  44.    
  45.     }
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement