Guest User

Untitled

a guest
Jul 16th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. /*By Jordi H. Castro*/
  2.  
  3. class sql
  4. {
  5.     var $servidor;
  6.     var $usuario;
  7.     var $password;
  8.     var $database;
  9.     var $enlace;
  10.    
  11.     public function info_servidor($servidor, $usuario, $password, $database){
  12.         $this->servidor=$servidor;
  13.         $this->usuario=$usuario;
  14.         $this->password=$password;
  15.         $this->database=$database;
  16.     }
  17.  
  18.     function enlace(){
  19.         $this->enlace =mysql_connect($this->servidor, $this->usuario, $this->password);
  20.         mysql_select_db($this->database);
  21.     }
  22.    
  23.     public function prueba_enlace(){
  24.        
  25.        return mysql_info($this->enlace);
  26.     }
  27.    
  28. }
  29.  
  30. $sql =new sql();
  31. $sql->info_servidor('localhost', 'root', 'jordis99', 'test');
  32. echo $sql->prueba_enlace();
Add Comment
Please, Sign In to add comment