Advertisement
Guest User

Untitled

a guest
Aug 7th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. class Conexion {
  2. private static $_dbUser = 'root';
  3. private static $_dbPass = 'xasasesa';
  4. private static $_dbDB = 'cobranzas';
  5. private static $_dbHost = 'localhost';
  6. private static $_connection = NULL;
  7.  
  8. public static function getConnection() {
  9. if (!self::$_connection) { //evaluo si la conexion no esta establecida ------ self::$_connection / $this->_connection
  10. self::$_connection = @new mysqli(self::$_dbHost, self::$_dbUser, self::$_dbPass, self::$_dbDB); //establezco la conexion
  11. if (self::$_connection -> connect_error) {
  12. die('Connect Error: ' . self::$_connection->connect_error); //Salgo de la ejecución del programa si no logro establecer la conexion
  13. }
  14. }
  15. return self::$_connection; //
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement